/* Lanorix Cloud: размеры и типографика кабинета (app.html). Подключается после site.css. Палитра — из site.css. */

/* Длинные названия не раздувают страницу */
h1, h2, h3 { overflow-wrap: anywhere; }
.section-head > div, .row > *, .copy-row > *, .inline-form > div { min-width: 0; }
.who { max-width: min(260px, 40vw); }

/* Типографика: вторичный текст не мельче 14px */
label, .label { font-size: 14px; }
.hint, .small, td .sub, .kv dt, .card-btn .meta, th, button.small-btn, .brand-sub, .footer { font-size: 14px; }
.tag { font-size: 13px; padding: 2px 10px; line-height: 1.4; }
code, .mono { font-size: 14px; }
td code { overflow-wrap: anywhere; }
th, td { line-height: 1.45; }
p, dd, li { line-height: 1.55; }
.kv dd { overflow-wrap: anywhere; }

/* Кнопки и поля: единая высота 40px (десктоп) и радиус 8px; на сенсорных/узких экранах 44px */
button, a.btn { min-height: 40px; border-radius: 8px; line-height: 1.3; }
input, select, textarea { min-height: 40px; border-radius: 8px; font-size: 16px; line-height: 1.4; }
.copy-row input { font-size: 16px; }
.inline-form .btn-wrap button { height: 40px; }
input[type="date"], input[type="number"] { min-width: 0; }
button.small-btn { min-height: 34px; }
button.primary:hover { background: #1b66da; }
button:disabled, button[aria-busy="true"] { cursor: not-allowed; }
button[aria-busy="true"] { cursor: progress; opacity: .8; }
button[aria-busy="true"]::after {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: app-spin .7s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::after { animation-duration: 2s; } }

/* Фокус: заметное кольцо на всех интерактивных элементах */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary:focus-visible, .tabs button[aria-selected="true"]:focus-visible { outline-color: #fff; outline-offset: 2px; box-shadow: 0 0 0 4px var(--accent-strong); }
.tabs button:focus-visible { outline-offset: -2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; box-shadow: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[readonly] { cursor: text; }
input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }

/* Вкладки */
.tabs { scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tabs button { min-height: 40px; padding: 8px 16px; }

/* Таблицы: прокрутка только внутри обёртки */
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 560px; }
td.actions { width: 1%; }
td.actions button { white-space: nowrap; }
td, th { overflow-wrap: anywhere; }
th { white-space: nowrap; overflow-wrap: normal; }
td.wrap-text { min-width: 120px; }

/* Диалог: влезает по высоте, прокрутка внутри */
dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
  overflow-y: auto; overscroll-behavior: contain; margin: auto;
}
.dlg { padding: 22px; }
.dlg h2 { overflow-wrap: anywhere; }
.dlg .actions button { min-width: 96px; }
.copy-row input { min-width: 0; }

/* Уведомления */
.toast { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); line-height: 1.45; overflow-wrap: anywhere; width: max-content; }
.toast.ok { border-color: var(--ok); }
.toast.bad { border-color: var(--bad); }

/* Вход */
.auth { margin-top: 32px; }
.auth .submit { min-height: 44px; }
.secret { font-size: 16px; }

@media (max-width: 768px), (pointer: coarse) {
  button, a.btn, input, select, textarea { min-height: 44px; }
  button.small-btn { min-height: 44px; padding: 8px 14px; font-size: 14px; }
  .tabs button { min-height: 44px; }
  .inline-form .btn-wrap button { height: 44px; }
  .card-btn { min-height: 44px; }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .section-head > .primary, .section-head > button { flex: 1 1 100%; }
  .section-head > div { flex: 1 1 100%; }
  .dlg { padding: 16px; }
  .dlg .actions { flex-direction: column-reverse; }
  .dlg .actions button { width: 100%; }
  .copy-row button { flex: 1 1 100%; }
  .row.mt > button { flex: 1 1 100%; }
  .inline-form > div { flex: 1 1 100%; }
  .topbar-right { gap: 6px; }
}
@media (max-width: 480px) {
  .topbar .wrap { padding-top: 6px; padding-bottom: 6px; }
  .toast { left: 16px; right: 16px; transform: none; width: auto; }
}

/* Кнопки действий в формах вне диалога (формы в панелях) */
.panel form > .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 640px) { .panel form > .actions { flex-direction: column-reverse; } .panel form > .actions button { width: 100%; } }
.inline-form.mt { margin-top: 0; }
