/* CRM – vzhled. Mobil první, bez externích knihoven. */
:root {
  --brand: #14305c; --brand-2: #1f9d6b; --brand-soft: #e7eef8;
  --bg: #f4f6f9; --surface: #fff; --text: #17202e; --muted: #667085; --line: #e2e6ee;
  --danger: #c0392b; --danger-soft: #fdecea; --warn: #b45309; --warn-soft: #fff4e5; --ok: #1f7a4f; --ok-soft: #e6f6ee;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15.5px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.env-bar { background: #7c2d12; color: #fff; text-align: center; font-weight: 600; font-size: 13px; padding: 5px 10px; }

/* rozložení */
.layout { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--brand); color: #dfe7f3; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
        display: flex; flex-direction: column; }
.side .brand { color: #fff; font-weight: 700; font-size: 19px; padding: 2px 10px 16px; letter-spacing: .2px; }
.side .brand span { color: #6fe0ae; }
.nav a { display: flex; align-items: center; gap: 10px; color: #dfe7f3; padding: 9px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.nav .ico { width: 20px; text-align: center; opacity: .9; }
.nav .sep { height: 1px; background: rgba(255,255,255,.12); margin: 10px 6px; }
.side-foot { margin-top: auto; padding: 10px; font-size: 13.5px; }
.side-foot a, .side-foot button { color: #dfe7f3; }
.userbox { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-2); color: #fff; display: inline-flex; align-items: center;
          justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--brand); }
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; max-width: 1200px; }

/* mobilní lišta */
.topbar { display: none; }
@media (max-width: 860px) {
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--brand); color: #fff; padding: 10px 14px;
            position: sticky; top: 0; z-index: 20; }
  .topbar .brand { font-weight: 700; font-size: 17px; color: #fff; }
  .topbar .brand span { color: #6fe0ae; }
  .topbar button { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; padding: 7px 12px; font: inherit; font-weight: 600; }
  .mobile-menu { display: none; background: var(--brand); padding: 4px 10px 14px; position: sticky; top: 52px; z-index: 19; }
  .mobile-menu.open { display: block; }
  .mobile-menu .side-foot { padding: 10px; color: #dfe7f3; }
  .main { padding: 16px 14px 70px; }
  h1 { font-size: 21px; }
}

/* stránka */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin: 0; }
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side-r { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: 13.5px; }
.stat.warn .n { color: var(--danger); }
@media (max-width: 860px) { .grid.two, .grid.side-r { grid-template-columns: 1fr; } }

/* tlačítka */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand);
       color: #fff; font: inherit; font-weight: 600; cursor: pointer; line-height: 1.2; text-decoration: none !important; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.green { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #f1c6c0; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 6px 10px; font-size: 13.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* formuláře */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field .help { color: var(--muted); font-size: 13px; margin-top: 3px; }
.field .err { color: var(--danger); font-size: 13.5px; margin-top: 3px; }
.field.check label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd6e2; border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.form-actions .spacer { flex: 1; }
.errorlist { color: var(--danger); margin: 0 0 10px; padding-left: 18px; }

/* filtry */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { max-width: 340px; }
.filters select { width: auto; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 20px; color: var(--muted); font-weight: 600; font-size: 14px; border: 1px solid transparent; }
.tabs a.active { background: var(--surface); color: var(--brand); border-color: var(--line); box-shadow: var(--shadow); }
.tabs a:hover { text-decoration: none; color: var(--brand); }

/* tabulky / seznamy */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600;
                padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.row-link { cursor: pointer; }
table.list tr.row-link:hover td { background: #f8fafc; }
@media (max-width: 700px) {
  table.list.responsive thead { display: none; }
  table.list.responsive tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.list.responsive td { display: block; border: 0; padding: 1px 0; }
  table.list.responsive td.hide-m { display: none; }
}
.items { list-style: none; margin: 0; padding: 0; }
.items li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.items li:last-child { border-bottom: 0; }
.items .grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 6px 0; }
dl.info { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; }
dl.info dt { color: var(--muted); font-size: 14px; }
dl.info dd { margin: 0; word-break: break-word; }

/* štítky */
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12.5px; font-weight: 600; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.gray { background: #eef0f3; color: var(--muted); }

/* zprávy */
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.msg.success { background: var(--ok-soft); border-color: #bfe6d1; color: #14532d; }
.msg.error { background: var(--danger-soft); border-color: #f1c6c0; color: #7f1d1d; }
.msg.warning { background: var(--warn-soft); border-color: #f7d9a8; color: #7c2d12; }
.msg.info { background: var(--brand-soft); border-color: #cddcf0; }

/* historie */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .tl-ico { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); flex: none;
                    display: flex; align-items: center; justify-content: center; font-size: 15px; }
.timeline .tl-body { flex: 1; min-width: 0; }
.timeline .tl-meta { font-size: 13px; color: var(--muted); }
.timeline .tl-text { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }

/* úkoly */
.task { display: flex; gap: 10px; align-items: flex-start; }
.task .check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #b8c2d3; background: #fff; cursor: pointer; flex: none; margin-top: 1px;
               display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; padding: 0; }
.task .check.on { background: var(--brand-2); border-color: var(--brand-2); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.today { color: var(--warn); font-weight: 600; }

/* stránkování */
.pager { display: flex; gap: 6px; justify-content: center; align-items: center; padding: 14px; }

/* přihlášení */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
        background: linear-gradient(160deg, var(--brand) 0%, #0d2142 100%); }
.auth .card { width: 100%; max-width: 380px; padding: 28px; }
.auth .logo { font-size: 24px; font-weight: 800; color: var(--brand); margin-bottom: 4px; }
.auth .logo span { color: var(--brand-2); }

/* dialog potvrzení */
dialog.confirm { border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog.confirm::backdrop { background: rgba(0,0,0,.35); }

.password-box { font: 600 22px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; background: var(--brand-soft); padding: 12px 16px;
                border-radius: 8px; display: inline-block; user-select: all; }
