/* Фирменный стиль «умно!жим» — те же токены, что у кабинета cab.umnozhim.ru */
:root {
  --navy: #0F1E3A;
  --navy-2: #1B2E52;
  --navy-line: #3A4C70;
  --green: #137A42;
  --green-hover: #0F6536;
  --lime: #3DDC84;
  --bg: #F5F4F0;
  --card: #FFFFFF;
  --line: #E4E2DA;
  --line-soft: #F0EEE7;
  --input-line: #D5D2C8;
  --text: #0F1E3A;
  --muted: #6A7386;
  --on-navy: #C9D2E3;
  --red: #C8372D;
  --red-bg: #FCEBE9;
  --amber: #B7791F;
  --amber-bg: #FDF3E1;
  --green-bg: #E6F5EC;
  --radius: 14px;
  --shadow: 0 12px 32px rgba(15, 30, 58, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, .logo, .kpi .v, .modal-head h2 { font-family: "Unbounded", "Manrope", sans-serif; letter-spacing: -0.01em; }
a { color: var(--green); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---- логотип ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.logo { font-size: 22px; font-weight: 700; color: #fff; }
.logo b { color: var(--lime); font-weight: 700; }
.logo-tag { font: 700 11px "Manrope", sans-serif; letter-spacing: .08em; color: var(--navy); background: var(--lime);
  border-radius: 6px; padding: 2px 7px; }

/* ---- шапка ---- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  padding: 14px 24px; background: var(--navy); color: #fff; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs button { border: 0; background: none; color: var(--on-navy); padding: 7px 12px; border-radius: 9px;
  font-weight: 600; font-size: 14px; cursor: pointer; }
.tabs button:hover { color: #fff; background: var(--navy-2); }
.tabs button.active { color: var(--navy); background: var(--lime); }
.actions { display: flex; gap: 8px; align-items: center; }
.badge { background: var(--red); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.topbar .btn.primary { background: var(--lime); color: var(--navy); }
.topbar .btn.primary:hover { background: #5BE59A; }
.topbar .btn.ghost { background: none; color: #fff; border: 1px solid var(--navy-line); }
.topbar .btn.ghost:hover { border-color: var(--lime); }

/* ---- кнопки ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--navy); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 16px; font: 600 14px "Manrope", sans-serif; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--green); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--green-hover); }
.btn.danger { color: var(--red); border-color: #F0C8C4; }
.btn.danger:hover { border-color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* ---- поля ---- */
input, select, textarea { border: 1px solid var(--input-line); background: #fff; border-radius: 9px; padding: 9px 11px;
  font: 500 14px "Manrope", sans-serif; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lime); border-color: var(--green); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--green); padding: 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; color: var(--muted); }

main { padding: 24px 24px 60px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type=search] { min-width: 300px; }

/* ---- воронка ---- */
.board { display: grid; grid-template-columns: repeat(6, minmax(230px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.column { background: #ECEBE4; border-radius: var(--radius); display: flex; flex-direction: column; min-height: 62vh; }
.column.drop { outline: 2px dashed var(--green); outline-offset: -2px; background: var(--green-bg); }
.col-head { padding: 12px 14px 10px; }
.col-head::before { content: ""; display: block; height: 4px; border-radius: 99px; margin-bottom: 10px; background: var(--c, var(--navy)); }
.col-head .name { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.col-head .name span:last-child { font-size: 12px; background: #fff; color: var(--muted); border-radius: 99px; padding: 0 8px; }
.col-head .sum { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 2px; }
.cards { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; cursor: grab;
  transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--green); box-shadow: 0 4px 14px rgba(15, 30, 58, .08); }
.card.dragging { opacity: .4; }
.card .t { font-weight: 700; font-size: 14px; line-height: 1.35; }
.card .c { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
.card .amt { font-weight: 700; color: var(--navy); font-size: 13px; }
.chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--green-bg); color: var(--green); white-space: nowrap; }
.chip.late { background: var(--red-bg); color: var(--red); }

/* ---- таблицы ---- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; padding: 6px 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #FAFAF7; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* ---- задачи ---- */
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick input[name=title] { min-width: 300px; }
.tasks { list-style: none; margin: 0; padding: 4px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.tasks li { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.tasks li:last-child { border-bottom: 0; }
.tasks li.done .tt { text-decoration: line-through; color: var(--muted); }
.tasks .tt { flex: 1; font-weight: 600; font-size: 14px; }
.tasks .meta { color: var(--muted); font-size: 12px; font-weight: 500; }
.tasks .late { color: var(--red); background: var(--red-bg); font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.tasks .today { color: var(--amber); background: var(--amber-bg); font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.tasks .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.tasks .del:hover { color: var(--red); }
.link { color: var(--green); cursor: pointer; text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ---- сводка ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi .l { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 600; margin: 6px 0 2px; white-space: nowrap; }
.kpi .v.bad { color: var(--red); }
.kpi .muted { font-size: 13px; }
.kpi.accent { background: var(--navy); border-color: var(--navy); color: #fff; }
.kpi.accent .l, .kpi.accent .muted { color: #AEB9CF; }
.kpi.accent .v { color: var(--lime); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 960px) { .grid2 { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.panel .table th, .panel .table td { padding-left: 0; }
.funnel-row { display: grid; grid-template-columns: 140px 1fr 80px; gap: 12px; align-items: center; margin: 8px 0; font-size: 14px; font-weight: 600; }
.bar { height: 10px; background: #ECEAE3; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c, var(--green)); border-radius: 99px; }

/* ---- модальное окно ---- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(640px, 94vw); background: var(--card); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15, 30, 58, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.x:hover { color: var(--navy); }
#modalBody { padding: 18px 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text); }
.form label.full, .form .full { grid-column: 1 / -1; }
.form input:disabled { background: var(--bg); color: var(--muted); }
.form-section { grid-column: 1 / -1; font: 600 13px "Unbounded", "Manrope", sans-serif; padding-top: 14px; margin-top: 2px; border-top: 1px solid var(--line); }
.hint { color: var(--muted); font-weight: 500; }
.links { display: flex; flex-direction: column; gap: 4px; margin-top: -6px; font-size: 13px; }
.links a { color: var(--green); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.links a:hover { text-decoration: underline; }
.links a::before { content: "↗ "; }
.sub { margin-top: 22px; }
.sub h4 { margin: 0 0 10px; font: 600 13px "Unbounded", "Manrope", sans-serif; display: flex; justify-content: space-between; align-items: center; }
.sub ul { list-style: none; margin: 0; padding: 0; }
.sub > ul > li { padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.sub .tasks { border-radius: 12px; }
.note-form { display: flex; gap: 8px; margin-bottom: 10px; }
.note-form input:not([type=date]) { flex: 1; }
.note-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.note-author { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ---- вход ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 34px 30px;
  display: flex; flex-direction: column; gap: 14px; }
.login-card .brand { gap: 12px; }
.login-card .logo { color: var(--navy); font-size: 30px; }
.login-card .logo b { color: var(--green); }
.login-sub { margin: -8px 0 6px; font-size: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; margin-top: 4px; }
.login-error { color: var(--red); font-size: 13px; font-weight: 600; min-height: 1em; }

/* ---- меню пользователя ---- */
.usermenu { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 5px; min-width: 180px; z-index: 10; }
.dropdown button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; font-weight: 600; font-size: 14px; }
.dropdown button:hover { background: var(--bg); }

/* ---- метки ---- */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px;
  background: #EEEDE8; color: var(--muted); }
.tag.admin { background: var(--green-bg); color: var(--green); }
.tag.off { background: var(--red-bg); color: var(--red); }

/* ---- уведомление ---- */
.toast { position: fixed; z-index: 90; right: 20px; top: 76px; max-width: 420px; background: #fff; color: var(--text);
  border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 12px; padding: 12px 16px;
  box-shadow: var(--shadow); font-size: 14px; font-weight: 600; }

@media (max-width: 720px) {
  .topbar { gap: 12px; padding: 12px 16px; }
  .tabs { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .actions { margin-left: auto; }
  main { padding: 20px 16px 48px; }
  .toolbar input[type=search], .quick input[name=title] { min-width: 0; width: 100%; }
  .form { grid-template-columns: 1fr; }
  .toast { left: 12px; right: 12px; top: 12px; max-width: none; }
}
