/* Облік · Стоматологія — оформлення в стилі 1С:Підприємство 8 (Таксі) */
:root {
  --bg: #efefef; --panel: #fff; --line: #c9c9c9; --line2: #e2e2e2; --text: #333; --muted: #8a8a8a;
  --yellow: #ffd400; --yellow2: #fff3bf; --sel: #fbe7a1; --hover: #fdf6dc; --link: #2f6fa7; --red: #c0392b; --head: #f4f4f4;
  --font: Arial, "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; font: 13px var(--font); color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ---------- вхід ---------- */
.login-wrap { height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(#f7f7f7, #e4e4e4); }
.login { width: 360px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.login h1 { margin: 0; padding: 18px 22px; font-size: 18px; background: var(--yellow); }
.login h1 small { display: block; font-size: 12px; font-weight: normal; margin-top: 4px; }
.login form { padding: 20px 22px 24px; display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; color: #555; }
.login .err { color: var(--red); min-height: 16px; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-rows: 38px 30px 1fr; grid-template-columns: 210px 1fr; height: 100%; }
.top { grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; padding: 0 12px; background: #fafafa; border-bottom: 1px solid var(--line); }
.top .logo { font-weight: bold; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.top .logo i { width: 22px; height: 22px; background: var(--yellow); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.top .org { color: #555; }
.top .sp { flex: 1; }
.top .user { color: #555; }
.top .menu-btn { border: 1px solid transparent; background: none; padding: 4px 8px; cursor: pointer; border-radius: 3px; }
.top .menu-btn:hover { background: #eee; border-color: var(--line); }
.tabs { grid-column: 1 / 3; display: flex; align-items: flex-end; gap: 2px; padding: 0 8px; background: #e6e6e6; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 10px; border: 1px solid var(--line); border-bottom: none; background: #f3f3f3; cursor: pointer; white-space: nowrap; max-width: 260px; border-radius: 3px 3px 0 0; }
.tab span { overflow: hidden; text-overflow: ellipsis; }
.tab.active { background: #fff; height: 28px; font-weight: bold; }
.tab b { font-weight: normal; color: #999; padding: 0 3px; border-radius: 2px; }
.tab b:hover { background: #ddd; color: #333; }
.sections { background: #fbfbfb; border-right: 1px solid var(--line); overflow-y: auto; padding: 6px 0; }
.sec { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; border-left: 4px solid transparent; }
.sec i { width: 20px; text-align: center; font-style: normal; color: #777; font-size: 15px; }
.sec:hover { background: var(--hover); }
.sec.active { background: var(--sel); border-left-color: #e8b800; font-weight: bold; }
.work { overflow: hidden; position: relative; background: #fff; }
.win { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- панель функцій розділу ---------- */
.funcs { padding: 18px 26px; overflow: auto; }
.funcs h2 { margin: 0 0 16px; font-size: 18px; font-weight: normal; }
.fgrid { display: flex; gap: 48px; flex-wrap: wrap; }
.fcol h3 { font-size: 13px; color: var(--muted); font-weight: normal; margin: 0 0 8px; text-transform: none; border-bottom: 1px solid var(--line2); padding-bottom: 4px; }
.fcol a, .fcol .todo { display: block; padding: 4px 0; font-size: 14px; }
.fcol .todo { color: #b0b0b0; cursor: default; }
.fcol .todo small { font-size: 11px; }
.home-note { margin-top: 26px; padding: 12px 14px; background: var(--yellow2); border: 1px solid #f0dc8c; max-width: 760px; line-height: 1.5; }

/* ---------- форми ---------- */
.form-head { padding: 10px 14px 6px; display: flex; align-items: center; gap: 10px; }
.form-head h2 { margin: 0; font-size: 17px; font-weight: normal; }
.form-head .mod { color: var(--red); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 12px 8px; border-bottom: 1px solid var(--line2); }
.btn { height: 26px; padding: 0 10px; border: 1px solid #b9b9b9; border-radius: 3px; background: linear-gradient(#fff, #ececec); cursor: pointer; white-space: nowrap; }
.btn:hover { background: linear-gradient(#fff, #e2e2e2); border-color: #999; }
.btn:active { background: #ddd; }
.btn.primary { background: linear-gradient(#ffe45c, #ffd400); border-color: #d6b200; font-weight: bold; }
.btn.primary:hover { background: linear-gradient(#ffe96f, #f5cb00); }
.btn:disabled { opacity: .5; cursor: default; }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.search { height: 26px; border: 1px solid #b9b9b9; padding: 0 8px; width: 260px; border-radius: 3px; }
.tb-right { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); }
.tb-right label { display: flex; align-items: center; gap: 4px; color: var(--text); }

/* ---------- таблиця списку ---------- */
.grid-wrap { flex: 1; overflow: auto; outline: none; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--head); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line2); padding: 6px 8px; text-align: left; font-weight: normal; color: #555; cursor: pointer; user-select: none; white-space: nowrap; }
.grid th.sorted::after { content: " ▲"; font-size: 9px; }
.grid th.sorted.desc::after { content: " ▼"; }
.grid td { padding: 4px 8px; border-bottom: 1px solid #eee; border-right: 1px solid #f3f3f3; vertical-align: top; }
.grid tr:hover td { background: var(--hover); }
.grid tr.sel td { background: var(--sel); }
.grid tr.del td { color: #aaa; text-decoration: line-through; }
.grid td.ico { width: 22px; text-align: center; color: #9bbb59; text-decoration: none; }
.grid tr.del td.ico { color: var(--red); }
.grid td.num { text-align: right; white-space: nowrap; }
.grid .empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- форма елемента ---------- */
.item-body { flex: 1; overflow: auto; padding: 12px 18px 30px; }
.fields { display: grid; grid-template-columns: 220px minmax(220px, 560px); gap: 7px 12px; align-items: center; }
.fields label { color: #555; }
.fields label.req::after { content: " *"; color: var(--red); }
.inp { height: 26px; border: 1px solid #b9b9b9; border-radius: 2px; padding: 0 6px; width: 100%; background: #fff; }
.inp:focus, textarea.inp:focus { outline: none; border-color: #e0b300; box-shadow: 0 0 0 2px #ffe680; }
textarea.inp { height: 54px; padding: 4px 6px; resize: vertical; }
.inp.num { text-align: right; max-width: 180px; }
.inp.short { max-width: 180px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: #d6a800; }
.ref { position: relative; display: flex; }
.ref .inp { padding-right: 46px; }
.ref .ref-btns { position: absolute; right: 2px; top: 2px; display: flex; }
.ref .ref-btns span { width: 21px; height: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #888; }
.ref .ref-btns span:hover { color: #333; background: #eee; }
.dropdown { position: fixed; z-index: 50; background: #fff; border: 1px solid #aaa; box-shadow: 0 4px 14px rgba(0,0,0,.15); max-height: 260px; overflow: auto; min-width: 260px; }
.dropdown div { padding: 5px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown div.on, .dropdown div:hover { background: var(--sel); }
.dropdown .none { color: var(--muted); cursor: default; }
.tpart { margin-top: 22px; max-width: 980px; }
.tpart h3 { font-size: 14px; font-weight: normal; margin: 0 0 6px; border-bottom: 1px solid var(--line2); padding-bottom: 4px; }
.tpart .toolbar { padding: 0 0 6px; border: none; }
.tpart table.grid td { padding: 2px 4px; }
.tpart table.grid td.n { width: 34px; text-align: right; color: var(--muted); padding-top: 7px; }
.tpart .inp { border-color: #ddd; }
.tpart tr.sel td { background: var(--yellow2); }
.msg { margin: 8px 18px 0; padding: 8px 12px; border: 1px solid; border-radius: 3px; }
.msg.err { background: #fdecea; border-color: #f5b7b1; color: #922; }
.msg.ok { background: #eef7e8; border-color: #c6e2b5; color: #3c6e1f; }

/* ---------- модальні вікна, повідомлення ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border: 1px solid #999; box-shadow: 0 10px 30px rgba(0,0,0,.25); min-width: 380px; max-width: 90vw; }
.modal h3 { margin: 0; padding: 10px 14px; background: #f3f3f3; border-bottom: 1px solid var(--line); font-size: 14px; }
.modal .mbody { padding: 16px; }
.modal .mbtns { padding: 10px 16px 14px; display: flex; gap: 8px; justify-content: flex-end; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 200; background: #fffbe6; border: 1px solid #e8cf6a; padding: 10px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.15); max-width: 420px; }
.toast.err { background: #fdecea; border-color: #f5b7b1; }
.popup-menu { position: fixed; z-index: 60; background: #fff; border: 1px solid #aaa; box-shadow: 0 4px 14px rgba(0,0,0,.15); min-width: 200px; }
.popup-menu div { padding: 7px 12px; cursor: pointer; }
.popup-menu div:hover { background: var(--sel); }
.badge { display: inline-block; padding: 1px 6px; border-radius: 8px; background: #eee; font-size: 11px; color: #555; }
.audit-data { font-family: Consolas, monospace; font-size: 11px; color: #555; white-space: pre-wrap; max-width: 600px; }
.grid td.nw { white-space: nowrap; }
.ptabs { display: flex; gap: 2px; margin-top: 22px; border-bottom: 1px solid var(--line); max-width: 1100px; }
.ptabs span { padding: 6px 14px; border: 1px solid var(--line); border-bottom: none; background: #f3f3f3; cursor: pointer; border-radius: 3px 3px 0 0; }
.ptabs span.on { background: #fff; font-weight: bold; margin-bottom: -1px; }
.ptabs + .tpart { margin-top: 8px; }
.tpart { max-width: 1100px; }
.top .org select { margin-left: 4px; }
