/* Цвета-заглушки до получения брендбука: меняются в одном месте, в :root. */
:root {
  --brand: #2f3b26;
  --brand-2: #4a5a3a;
  --accent: #b8892f;
  --bg: #f4f3ef;
  --card: #ffffff;
  --text: #1f2320;
  --muted: #6b6f68;
  --line: #dddbd3;
  --red-bg: #fbe3e1; --red: #a32d2d;
  --green-bg: #e2f1dc; --green: #3b6d11;
  --yellow: #c99a06;
  --radius: 8px;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--brand-2); }
h1 { font-size: 22px; margin: 0; font-weight: 600; }
h2 { font-size: 17px; margin: 24px 0 8px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* шапка */
.top { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; }
.top .in { display: flex; align-items: center; gap: 14px; padding: 8px 16px; max-width: 1500px; margin: 0 auto; flex-wrap: wrap; }
.top a { color: #fff; text-decoration: none; opacity: .9; }
.top a:hover, .top a.on { opacity: 1; text-decoration: underline; }
.logo { font-weight: 700; letter-spacing: .02em; margin-right: 8px; }
.top .sp { flex: 1; }
.badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 3px; }
main { max-width: 1500px; margin: 0 auto; padding: 16px; }

/* кнопки и поля */
.btn { display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--radius);
  padding: 6px 12px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 2px 8px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 100%; }
textarea { width: 100%; }
.msg { padding: 8px 12px; border-radius: var(--radius); margin-bottom: 10px; background: var(--green-bg); color: var(--green); }
.msg.error { background: var(--red-bg); color: var(--red); }

/* панель месяца */
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bar h1 { min-width: 170px; text-align: center; }
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; }
.filters summary { cursor: pointer; }
.filters form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chip { border: 1px solid var(--line); border-radius: 14px; padding: 2px 10px; background: #fff; font-size: 13px; text-decoration: none; color: var(--text); }

/* таблица месяца */
.month { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.month th { background: var(--brand-2); color: #fff; font-weight: 500; text-align: left; padding: 6px 8px; font-size: 13px; position: sticky; top: 44px; }
.month td { border-top: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.month tr.day td { background: #e9e7de; font-weight: 600; padding: 5px 8px; }
.month tr.day.weekend td { background: #e3dfd2; }
.month tr.day.today td { background: #f1e2bf; }
.month tr.day .add { float: right; font-weight: 400; font-size: 13px; }
.month tr.ev { cursor: pointer; }
.month tr.ev:hover td { background: #faf9f5; }
.month tr.ev td:first-child { border-left: 5px solid var(--dept, #999); white-space: nowrap; }
.month tr.ev.cancelled td { color: #9a9a94; }
.month tr.ev.cancelled .t { text-decoration: line-through; }
.month tr.empty td { color: var(--muted); font-size: 13px; padding: 3px 8px 3px 13px; }
.t { font-weight: 600; }
.desc { max-width: 320px; white-space: pre-line; }
.memo-red { background: var(--red-bg); color: var(--red); border-radius: 4px; padding: 1px 5px; white-space: pre-line; display: inline-block; }
.memo-green { background: var(--green-bg); color: var(--green); border-radius: 4px; padding: 1px 5px; white-space: pre-line; display: inline-block; }
.ic { margin-left: 4px; font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 4px; vertical-align: middle; }
.dot.green { background: #3b9b2f; } .dot.yellow { background: var(--yellow); } .dot.red { background: #d13b3b; }
.tag { display: inline-block; font-size: 12px; border-radius: 4px; padding: 0 5px; background: #eee; color: var(--muted); margin-left: 4px; font-weight: 400; }
.tag.common { background: #f1e2bf; color: #6b4b0a; }
.tag.moved { background: #e1ecf7; color: #1d4f80; }
.tag.confirmed { background: var(--green-bg); color: var(--green); }
.tag.done { background: #ecebe5; }
.unsure { background: #fff8e6; border: 1px solid #ecd9a8; border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; }
.unsure ul { margin: 4px 0 0; padding-left: 18px; }

/* карточки и списки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; }
.grid dt { color: var(--muted); }
.grid dd { margin: 0; white-space: pre-line; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 12px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-color: var(--brand); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 8px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.log td { padding: 4px 8px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.log .old { color: var(--red); text-decoration: line-through; }
.log .new { color: var(--green); }

/* форма */
.form .f { margin-bottom: 12px; }
.form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.form .req > label:not(.check)::after { content: " *"; color: var(--red); }
.form .two { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.form .four { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form input[type=date],
.form input[type=time], .form input[type=url], .form select, .form textarea { width: 100%; }
.form ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.form ul label { display: inline; color: var(--text); font-size: 15px; }
.form label.check { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; margin-top: 6px; }
.form h2 { font-size: 15px; color: var(--brand-2); border-top: 1px solid var(--line); padding-top: 12px; margin: 16px 0 10px; }
.errorlist { color: var(--red); font-size: 13px; margin: 2px 0 0 !important; display: block !important; }
.help { font-size: 12px; color: var(--muted); }
details.more { margin: 10px 0; }
details.more > summary { cursor: pointer; color: var(--brand-2); margin-bottom: 10px; }
.fab { display: none; }

/* телефон: месяц превращается в ленту карточек */
@media (max-width: 760px) {
  main { padding: 10px; }
  .month, .month tbody, .month tr, .month td { display: block; width: 100%; }
  .month thead { display: none; }
  .month { border: 0; background: transparent; }
  .month tr.day td { margin-top: 10px; border-radius: 6px; }
  .month tr.ev { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--dept, #999); border-radius: 6px; margin-top: 6px; padding: 6px 0; }
  .month tr.ev td { border: 0 !important; padding: 1px 10px; }
  .month tr.ev td:empty { display: none; }
  .month td[data-l]:not(:empty)::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  .month td.c-time::before, .month td.c-title::before { content: none !important; }
  .desc { max-width: none; }
  .grid { grid-template-columns: 1fr; }
  .grid dt { margin-top: 6px; }
  .form .two { grid-template-columns: minmax(0,1fr); gap: 0; }
  .form .four { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .fab { display: block; position: fixed; right: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 32px; line-height: 54px; text-align: center; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); z-index: 20; }
  .hide-m { display: none; }
}
