:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #0f1420;
  --muted: #6b7385;
  --border: #e4e7ec;
  --border-strong: #cdd2db;
  --primary: #2f5bea;
  --primary-hover: #2449c7;
  --primary-soft: #eaf0ff;
  --ok: #0f9d58;
  --ok-soft: #e6f6ee;
  --warn: #b45309;
  --warn-soft: #fff4e5;
  --danger: #d92d20;
  --danger-soft: #fdeeec;
  --purple: #6d3fc8;
  --purple-soft: #f1ebfc;
  --side-bg: #eef0f3;
  --side-text: #4b5468;
  --side-hover: #e2e5ea;
  --radius: 6px;
  --radius-sm: 4px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14.5px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 15px; margin: 0 0 14px; letter-spacing: -.01em; font-weight: 600; }
h3 { font-size: 11.5px; margin: 22px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
code { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
[hidden] { display: none !important; }
.ico { width: 17px; height: 17px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.text-ok { color: var(--ok); font-weight: 600; }
.text-danger { color: var(--danger) !important; }

/* Лява странична лента */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px; z-index: 40;
  display: flex; flex-direction: column; gap: 4px; padding: 18px 12px 14px;
  background: var(--side-bg); color: var(--side-text); border-right: 1px solid #e0e3e8; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name small { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.side-nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; font-size: 14px; }
.side-nav a:hover { background: var(--side-hover); color: var(--text); text-decoration: none; }
.side-nav a.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--primary), 0 0 0 1px #e0e3e8; }
.side-nav a.on .ico { color: var(--primary); }
.side-company { display: flex; flex-direction: column; padding: 8px 10px; color: var(--text); line-height: 1.35; }
.side-nav .side-company { margin: 14px 0 6px; border-top: 1px solid #dde0e6; padding-top: 14px; border-radius: 0; }
.side-company .muted { color: #8a92a3; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.side-company b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav a.side-company { align-items: flex-start; gap: 0; }
.side-nav a.side-company:hover { background: transparent; }
.side-nav a.side-company:hover b { color: var(--primary); }
.side-user { display: flex; align-items: center; gap: 4px; padding-top: 12px; border-top: 1px solid #dde0e6; }
.side-user form { margin: 0; }
.side-user .icon-btn { color: var(--side-text); }
.side-user .icon-btn:hover { background: var(--side-hover); color: var(--text); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border-radius: var(--radius-sm); color: var(--text); }
.me:hover { background: var(--side-hover); text-decoration: none; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-text b, .me-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.me-text span { font-size: 12px; font-weight: 400; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700; flex: none; letter-spacing: .02em; }
a.avatar:hover { text-decoration: none; }
.avatar-lg { width: 52px; height: 52px; font-size: 17px; border-radius: var(--radius); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.has-sidebar .content { margin-left: 240px; min-height: 100vh; }
.mobile-bar, .side-backdrop { display: none; }

.imp-bar { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 8px 16px; background: #1d1404; color: #fbbf24; font-size: 13.5px; }
.imp-bar b { color: #fff; }
.imp-bar form { margin: 0; }

/* Съдържание */
.main { max-width: 1320px; margin: 0 auto; padding: 28px 28px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.count { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: var(--radius-sm); background: #e8eaee; color: var(--muted); font-size: 13px; font-weight: 600; vertical-align: 3px; line-height: 22px; }
.back { display: inline-block; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.back:hover { color: var(--text); text-decoration: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.empty { text-align: center; padding: 40px 20px; }
.card.soon { border-style: dashed; background: transparent; }

/* Бутони */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: #f0f2f5; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn-block { display: flex; width: 100%; }
.btn .ico { width: 15px; height: 15px; }

/* Форми */
.field { margin-bottom: 14px; min-width: 0; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: #3d4556; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; min-height: 38px; padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font: inherit; font-size: 14px; transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover { border-color: #b4bbc7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 91, 234, .14); }
input:disabled, select:disabled { background: #f4f5f7; color: var(--muted); }
input.upper { text-transform: uppercase; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: 5px; font-weight: 500; }
.check { display: flex; align-items: center; gap: 9px; margin: 8px 0 16px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--primary); flex: none; }
.grid { display: grid; gap: 0 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.field-actions { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.card .form-actions { margin-bottom: 0; padding-top: 4px; }
.perms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.perms .check { margin: 6px 0; }

/* Съобщения */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; border-left-width: 3px; font-size: 14px; }
.flash-success { background: var(--ok-soft); border-color: #a7dcbf; border-left-color: var(--ok); color: #0b5b34; }
.flash-error { background: var(--danger-soft); border-color: #f4bdb7; border-left-color: var(--danger); color: #8e1d14; }
.flash-info { background: var(--primary-soft); border-color: #c3d2fb; border-left-color: var(--primary); color: #1d3b9e; }
.flash-password { background: #fffaeb; border-color: #f3dc8c; border-left-color: #d4a106; color: #5b4300; }
.flash-password > div:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.pw { font-size: 17px; font-weight: 700; letter-spacing: .06em; background: #fff; border: 1px dashed #d9bd5a; padding: 2px 10px; border-radius: var(--radius-sm); user-select: all; }

/* Филтри */
.filters { padding: 12px; }
.search-row { display: flex; gap: 8px; }
.search-input { position: relative; flex: 1; }
.search-input .ico { position: absolute; left: 11px; top: 10.5px; color: var(--muted); }
.search-input input { padding-left: 35px; }
.filters-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 0 12px; margin-top: 12px; }
.filters-grid.open { display: grid; }
.search-row + .filters-grid { padding-top: 12px; border-top: 1px solid var(--border); }
.filters .field { margin-bottom: 10px; }

/* Таблици */
.table-card { padding: 0; overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
table.list td { padding: 10px 14px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr[data-href] { cursor: pointer; }
table.list tbody tr:hover { background: #f8f9fb; }
table.list .cell-main { font-weight: 600; }
table.list .cell-main a { color: var(--text); }
table.list .cell-dot { width: 22px; padding-right: 0; }
table.list .cell-actions { white-space: nowrap; text-align: right; }
table.list .cell-actions form { display: inline; margin: 0; }
tr.is-released td { color: var(--muted); }
tr.is-current { background: #f6f8ff; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c3c9d4; vertical-align: 1px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.abbr { display: inline-block; font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 600; background: #eef0f3; color: #2f3747; border-radius: var(--radius-sm); padding: 1px 6px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: var(--radius-sm); font-size: 11.5px; font-weight: 600; vertical-align: 1px; white-space: nowrap; line-height: 19px; }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-green { background: var(--ok-soft); color: var(--ok); }
.badge-grey { background: #eef0f3; color: var(--muted); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.ev { display: inline-block; padding: 1px 7px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; background: #eef0f3; color: #3a4459; line-height: 19px; }
.ev-login { background: var(--ok-soft); color: var(--ok); }
.ev-failed, .ev-blocked { background: var(--danger-soft); color: var(--danger); }
.ev-impersonate_start, .ev-impersonate_end { background: var(--warn-soft); color: var(--warn); }
.ev-password_change, .ev-password_reset { background: var(--purple-soft); color: var(--purple); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 16px; }

/* Табове (номенклатури) */
.tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; margin: -4px 0 20px; border-bottom: 1px solid var(--border); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 8px 10px 9px; color: var(--muted); font-weight: 500; font-size: 13.5px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.tabs .ico { width: 15px; height: 15px; }

/* Табло */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 4px; }
.stat { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.stat-value { font-size: 30px; font-weight: 700; display: flex; align-items: center; gap: 10px; letter-spacing: -.02em; }
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px; }
.people a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); }
.people a:hover { background: var(--bg); text-decoration: none; }
.people .small { margin-left: auto; }

/* Детайл */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.stack { display: grid; gap: 8px; }
.stack form { margin: 0; }
.log-mini { list-style: none; margin: 0 0 12px; padding: 0; }
.log-mini li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.log-mini li:last-child { border-bottom: 0; }
.log-mini .muted { grid-column: 2; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-head h2 { margin: 0; font-size: 18px; }

/* Вход */
.auth-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 380px; padding: 32px; }
.auth-card h1 { margin-bottom: 20px; font-size: 20px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 26px; }
.auth-logo img { width: 32px; height: 32px; border-radius: var(--radius-sm); }

/* Номенклатури и импорт */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-hint { margin: -8px 0 16px; }
.nom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 16px; }
.nom-grid .nom-text { grid-column: span 2; }
.status-select, select.auto-width { width: auto; min-width: 140px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; margin-bottom: 6px; }
.map-grid label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.map-grid select.mapped { border-color: #8fd1ae; background: #f3fbf6; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 16px; }
table.preview td, table.preview th { white-space: nowrap; font-size: 13px; padding: 8px 12px; }
.kv-left dd { text-align: left; }
input[type=file] { padding: 6px; }

/* Мобилна версия */
@media (max-width: 860px) {
  .has-sidebar .content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 280px; padding-top: calc(18px + env(safe-area-inset-top)); }
  .menu-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(15, 20, 32, .18); }
  .menu-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 19, 28, .45); }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0 6px;
    background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .icon-btn { color: var(--text); }
  .mobile-bar .icon-btn:hover { background: var(--side-hover); }
  .mobile-bar .ico { width: 21px; height: 21px; }
  .mobile-title { flex: 1; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding: 16px 12px calc(32px + env(safe-area-inset-bottom)); }
  h1 { font-size: 19px; }
  .g2, .g3, .stats, .perms { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .stats { gap: 8px; margin-bottom: 14px; }
  .stats .card { margin-bottom: 0; }
  .split { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .search-row { flex-wrap: wrap; }
  .search-input { flex-basis: 100%; }
  .search-row .btn { flex: 1; }
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .filters-grid .field-actions { grid-column: 1 / -1; }
  .page-head .btn-primary { width: 100%; }
  .form-actions .btn { flex: 1; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .nom-grid .nom-text { grid-column: auto; }
  .status-select { flex: 1; }
  .tabs { margin: -4px 0 16px; }
  .tabs a { padding: 7px 8px 8px; font-size: 13px; }
  .tabs .ico { display: none; }
  input, select { font-size: 16px; } /* без zoom в iOS */

  /* Таблици → карти */
  .table-card { background: none; border: 0; overflow: visible; }
  table.cards, table.cards tbody { display: block; }
  table.cards thead { display: none; }
  table.cards tr { display: flex; flex-direction: column; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
  table.cards tbody tr:hover { background: var(--surface); }
  table.cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; }
  table.cards td.cell-main { order: -1; display: block; text-align: left; font-size: 15px; padding: 0 22px 6px 0; }
  table.cards td.cell-main::before, table.cards td.cell-dot::before, table.cards td.cell-actions::before { content: none; }
  table.cards td.cell-dot { position: absolute; top: 15px; right: 14px; padding: 0; width: auto; }
  table.cards td.cell-actions { justify-content: flex-start; flex-wrap: wrap; padding-top: 10px; }
  table.cards td[colspan] { display: block; text-align: left; }
}

@media (max-width: 380px) {
  .filters-grid { grid-template-columns: 1fr; }
}

/* Продукти към дейност */
.chip { display: inline-block; padding: 0 6px; margin: 1px 2px 1px 0; border-radius: var(--radius-sm); background: #eef0f3; color: #2f3747; font-size: 11.5px; font-weight: 600; line-height: 19px; white-space: nowrap; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.chip-checks label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip-checks input { width: 14px; height: 14px; min-height: 0; margin: 0; accent-color: var(--primary); }
.nom-grid .nom-products { grid-column: 1 / -1; }
.nom-bool .check { margin: 8px 0 0; }
table.list td.t-products { min-width: 250px; }
table.list td.t-text { max-width: 360px; }
table.list td.t-activity { min-width: 220px; }
@media (max-width: 860px) { table.list td.t-products, table.list td.t-text, table.list td.t-activity { min-width: 0; max-width: none; } table.cards td.t-products { flex-wrap: wrap; justify-content: flex-end; } }
.nom-section { grid-column: 1 / -1; margin: 6px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ===== Моето време ===== */
.time-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.time-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.person-pick select { width: auto; min-width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg a { padding: 7px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg a + a { border-left: 1px solid var(--border-strong); }
.seg a:hover { text-decoration: none; color: var(--text); background: #f4f5f7; }
.seg a.on { background: var(--text); color: #fff; }

.week { display: flex; align-items: stretch; gap: 6px; margin-bottom: 16px; }
.week-nav { display: grid; place-items: center; width: 32px; flex: none; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--muted); font-size: 18px; }
.week-nav:hover { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.wday { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px 7px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--text); }
.wday:hover { text-decoration: none; border-color: var(--border-strong); }
.wday.weekend { background: #fafbfc; }
.wday.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.wd-name { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.wday.today .wd-name { color: var(--primary); }
.wd-num { font-size: 17px; font-weight: 700; }
.wd-total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wd-bar, .cal-bar { display: block; width: 70%; height: 3px; background: #edf0f3; margin-top: 3px; }
.wd-bar i, .cal-bar i { display: block; height: 100%; background: var(--primary); }

.day-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.day-date { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.day-date::first-letter { text-transform: uppercase; }
.day-sum { color: var(--muted); font-size: 14px; }
.day-sum b { color: var(--text); font-size: 16px; }
.btn-lg { min-height: 44px; padding: 10px 20px; font-size: 14.5px; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; }
.quick-btn { border: 1px dashed var(--border-strong); background: #fff; border-radius: var(--radius-sm); padding: 5px 10px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.quick-btn:hover { border-style: solid; border-color: var(--primary); color: var(--primary); }
.day-empty { padding: 48px 20px; }

.entries { display: flex; flex-direction: column; gap: 6px; }
.entry { position: relative; display: flex; gap: 16px; padding: 12px 48px 12px 14px; background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); cursor: pointer; }
.entry:hover, .entry:focus { border-color: var(--border-strong); border-left-color: var(--primary); outline: none; background: #fcfdff; }
.entry-time { display: flex; flex-direction: column; min-width: 58px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.entry-time b { font-size: 15px; }
.entry-time span { color: var(--muted); font-size: 13px; }
.entry-time em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--primary); margin-top: 3px; }
.entry-body { flex: 1; min-width: 0; }
.entry-act { font-weight: 600; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; font-size: 13.5px; color: #3d4556; }
.entry-notes { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.entry-dup { position: absolute; top: 8px; right: 6px; }
.chip-blue { background: var(--primary-soft); color: var(--primary); }
.gap { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 6px 4px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; }

/* Месец */
.month-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.month-bar h2 { margin: 0; min-width: 150px; text-align: center; font-size: 17px; }
.month-sum { margin-left: auto; color: var(--muted); }
.month-sum b { color: var(--text); font-size: 16px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 20px; }
.cal-h { padding: 4px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cal-d { display: flex; flex-direction: column; min-height: 76px; padding: 7px 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
.cal-d:hover { text-decoration: none; border-color: var(--border-strong); }
.cal-d.empty { background: transparent; border-color: transparent; }
.cal-d.weekend { background: #fafbfc; }
.cal-d.today { border-color: var(--primary); }
.cal-n { font-size: 13px; font-weight: 600; color: var(--muted); }
.cal-t { margin-top: auto; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-d.full .cal-bar i { background: var(--ok); }
.cal-bar { width: 100%; }
.card-pad { padding: 16px 16px 0; }
.share { height: 3px; background: #edf0f3; margin-top: 5px; }
.share i { display: block; height: 100%; background: var(--primary); }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.report tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); background: #fafbfc; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.active-filter { margin-top: 4px; font-size: 13.5px; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--muted); }

/* Форма за въвеждане */
.te-modal { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; }
.te-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 32, .35); }
.te-sheet { position: relative; width: 520px; max-width: 100%; height: 100%; display: flex; flex-direction: column; background: #fff; box-shadow: -10px 0 40px rgba(15, 20, 32, .15); }
.te-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.te-top h2 { margin: 0; font-size: 17px; }
.te-body { flex: 1; overflow-y: auto; padding: 18px; }
.te-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #fafbfc; }
.te-del { margin-left: auto; }
.te-when { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 10px; align-items: end; }
.te-when .field { margin-bottom: 8px; }
.te-dur { padding: 0 2px 17px; font-weight: 700; font-size: 15px; color: var(--primary); white-space: nowrap; min-width: 66px; text-align: right; }
.te-dur.bad { color: var(--danger); }
.te-quickdur { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.te-quickdur .btn { min-height: 28px; padding: 3px 9px; font-weight: 500; }
.te-body > .field-error { margin: 0 0 6px; }
.te-body .field-error:empty { display: none; }
textarea { resize: vertical; min-height: 70px; }
.te-more { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; }
.te-more summary { display: flex; gap: 10px; align-items: center; padding: 10px 0; cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none; }
.te-more summary::-webkit-details-marker { display: none; }
.te-more summary::before { content: "\25B8"; color: var(--muted); }
.te-more[open] summary::before { content: "\25BE"; }
.te-more[open] { padding-bottom: 4px; }
body.te-open { overflow: hidden; }

.ta { position: relative; }
.ta.has-value .ta-input { border-color: #9fb3ec; background: #f7f9ff; font-weight: 600; }
.ta-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 2px); max-height: 300px; overflow-y: auto; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(15, 20, 32, .12); }
.ta-group { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.ta-item { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; cursor: pointer; font-size: 14px; }
.ta-item.on, .ta-item:hover { background: var(--primary-soft); }
.ta-code { min-width: 30px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ta-label { flex: 1; }
.ta-sub { font-size: 12px; color: var(--muted); }
.ta-none { padding: 10px; color: var(--muted); font-size: 13.5px; }
.chip-radios { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-radio { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text); }
.chip-radio:hover { border-color: var(--primary); }
.chip-radio.on { background: var(--primary); border-color: var(--primary); color: #fff; }

@media (max-width: 860px) {
  .week { gap: 3px; }
  .week-nav { width: 22px; }
  .wday { padding: 6px 2px; }
  .wd-num { font-size: 15px; }
  .wd-total { font-size: 11px; }
  .day-bar .btn-primary { width: 100%; }
  .entry { gap: 12px; padding: 10px 44px 10px 12px; }
  .te-sheet { width: 100%; }
  .te-when { grid-template-columns: 1fr 1fr; }
  .te-when .field:first-child { grid-column: 1 / -1; }
  .te-dur { grid-column: 1 / -1; padding: 0 0 6px; text-align: left; }
  .cal { gap: 2px; }
  .cal-d { min-height: 54px; padding: 4px 5px; }
  .cal-t { font-size: 13px; }
  .cal-h { padding: 4px 2px; text-align: center; }
  .month-sum { margin-left: 0; width: 100%; }
  .person-pick select { min-width: 0; width: 100%; }
}
