/* Shared application components. */
.main-area {
  grid-template-rows: auto minmax(0, 1fr);
}
.page-content {
  min-width: 0;
  min-height: 0;
}
.screen-body {
  min-height: 0;
}
.section-select {
  min-width: 155px;
  max-width: 240px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 0;
}
.header-actions {
  flex-wrap: nowrap;
  max-width: 45vw;
  overflow: hidden;
}
.header-actions .button {
  min-width: 30px;
}
.topbar-actions {
  gap: 5px;
}
.header-tools {
  max-width: 65%;
  flex: 1;
  min-width: 0;
}
.tool-window {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.tool-window > * {
  flex-shrink: 0;
}
.tool-window > .input-wrap {
  min-width: 140px;
  width: 180px;
  flex-shrink: 1;
}
.tool-window .select-control {
  max-width: 175px;
}
.tool-arrow {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  height: 30px;
  width: 25px;
  flex: 0 0 25px;
  border-radius: 7px;
}
.tool-arrow:disabled {
  opacity: 0.3;
}
.table-panel {
  width: 100%;
}
[data-table] table {
  table-layout: fixed;
}
[data-table] th:first-child,
[data-table] td:first-child {
  width: auto;
}
[data-table] td .button {
  min-height: 26px;
  padding: 5px 6px;
  font-size: 10px;
  margin: 0 2px;
}
[data-table] th:last-child,
[data-table] td:last-child {
  width: 105px;
}
th.select-col,
td.select-col {
  width: 34px !important;
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
.shell-metric {
  text-align: left;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.shell-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.settings-form > h3 {
  margin-top: 0;
}
.settings-form .report-item {
  min-height: 42px;
}
.checkbox-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 35px;
}
.checkbox-field input {
  width: 18px;
  min-height: 18px;
}
.checkbox-field label {
  margin: 0;
}
.field input[type="file"] {
  padding: 9px;
  max-width: 100%;
  font-size: 11px;
}
.field select[multiple] {
  height: 110px;
}
.field textarea {
  min-height: 60px;
  max-height: 100px;
}
.modal.visible {
  max-height: calc(100dvh - 24px);
  height: auto;
}
.modal-body {
  min-height: 0;
  overflow: hidden;
}
.modal-foot {
  flex-shrink: 0;
}
.modal-head h2 {
  font-size: 17px;
}
.modal-body .field {
  margin-bottom: 12px;
}
.modal-body p {
  font-size: 12px;
  line-height: 1.5;
}
.drawer.visible {
  width: min(680px, 100vw);
}
.drawer-tabs {
  gap: 3px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.drawer-tabs .button {
  min-width: 0;
  padding: 7px 5px;
  font-size: 10px;
  flex: 1;
}
.drawer-body {
  min-height: 0;
  overflow: hidden;
}
.dialog-scroll {
  min-height: 0;
  max-height: calc(100dvh - 170px);
  overflow: auto;
  overscroll-behavior: contain;
}
.drawer-body.dialog-scroll {
  flex: 1;
  height: auto;
  max-height: none;
}
.dialog-pagebar {
  min-height: 38px;
  padding: 6px 18px;
}
.dialog-pagebar .button {
  min-height: 25px;
  padding: 4px 7px;
}
.dialog-scroll > p,
.dialog-scroll > div,
.dialog-scroll > pre {
  flex-shrink: 0;
}
.json-details {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.5;
}
.detail-list {
  gap: 6px;
}
.detail-list .button {
  max-width: 100%;
}
.notification-record {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.notification-record p {
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.notification-record small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}
.toast.error {
  background: #692d3b;
}
.toast.error i {
  background: #ffb7be;
}
.local-status {
  font-size: 10px;
  color: var(--muted);
}
.empty-state {
  font-size: 12px;
}
#printArea {
  display: none;
}
.table-viewport a {
  color: var(--accent);
}
.drawer-body .quick-list {
  gap: 8px;
}
.settings-form .detail-description {
  margin-bottom: 18px;
}
.dialog-scroll > .button {
  margin: 4px;
  white-space: normal;
  text-align: left;
}
.dialog-scroll table {
  font-size: 11px;
}
.dialog-scroll table td {
  height: 40px;
  padding: 5px;
}
.modal-head,
.drawer-head {
  flex-shrink: 0;
}
.modal-head h2,
.drawer-head h2 {
  overflow-wrap: anywhere;
}
.header-title {
  font-size: 18px;
}
.table-toolbar {
  height: 40px;
  min-height: 40px;
}
.module-toolbar {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  min-height: 34px;
}
.module-toolbar .button {
  font-size: 11px;
}
.text-muted {
  color: var(--muted);
}
.status {
  font-size: 10px;
}
@media (max-width: 1100px) {
  .header-tools {
    max-width: 65%;
  }
  .header-actions .button {
    font-size: 10px;
    padding: 7px;
  }
  .topbar {
    padding: 0 16px;
  }
}
@media (max-width: 700px) {
  .header-actions {
    max-width: 38vw;
  }
  .header-title {
    font-size: 16px;
  }
  .header-tabs {
    max-width: 42%;
  }
  .header-tools {
    max-width: 65%;
  }
  .header-tabs .section-select {
    min-width: 125px;
    max-width: 160px;
  }
  .topbar-context {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .tool-window > .input-wrap {
    min-width: 100px;
    width: 145px;
  }
  .tool-window .select-control {
    max-width: 150px;
  }
  .drawer-tabs .button {
    font-size: 10px;
    padding: 7px 3px;
  }
  .shell-action-grid {
    grid-template-columns: 1fr 1fr;
  }
  .drawer.visible {
    width: 100vw;
  }
  .header-actions .button:not(:first-child) {
    display: none;
  }
  .settings-form .report-item {
    font-size: 11px;
  }
  .module-toolbar {
    flex-wrap: wrap;
  }
  .shell-metric {
    padding: 12px;
  }
}
@media (max-width: 480px) {
  .topbar-main {
    gap: 5px;
  }
  .topbar-actions {
    gap: 2px;
  }
  .header-title {
    font-size: 15px;
  }
  .header-actions {
    max-width: 100px;
  }
  .header-actions .button {
    font-size: 10px;
    min-height: 29px;
  }
  .header-tabs .section-select {
    min-width: 115px;
    max-width: 135px;
    font-size: 11px;
  }
  .header-tabs {
    max-width: 40%;
  }
  .header-tools {
    max-width: 60%;
  }
  .topbar-context {
    min-height: 43px;
  }
  .tool-window .button {
    font-size: 10px;
    padding: 6px;
  }
  .tool-window .select-control {
    max-width: 120px;
  }
  .tool-arrow {
    flex-basis: 20px;
    width: 20px;
  }
  .drawer-body {
    padding: 14px;
  }
  .drawer-tabs {
    padding: 8px;
  }
  .drawer-tabs .button {
    font-size: 9px;
  }
  .field select[multiple] {
    height: 90px;
  }
  .shell-action-grid {
    grid-template-columns: 1fr;
  }
  .modal-body {
    padding: 15px;
  }
  .modal-foot {
    padding: 12px 15px;
  }
  .dialog-scroll {
    max-height: calc(100dvh - 210px);
  }
  .table-toolbar h3 {
    font-size: 12px;
  }
  .header-tools .input-wrap {
    height: 31px;
  }
  .header-tools .input-wrap input {
    font-size: 11px;
  }
}
@media print {
  html,
  body {
    overflow: visible !important;
    height: auto !important;
    background: #fff !important;
    color: #000 !important;
  }
  .app-shell,
  .overlay,
  .modal,
  .drawer,
  .toast-stack {
    display: none !important;
  }
  #printArea {
    display: block !important;
    padding: 12mm;
    font-family: Arial, sans-serif;
  }
  #printArea table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
  }
  #printArea td,
  #printArea th {
    border: 1px solid #999;
    padding: 5px;
    height: auto;
    white-space: normal;
    width: auto !important;
  }
  #printArea svg {
    max-width: 100px;
    max-height: 100px;
  }
  .print-label {
    display: inline-block;
    border: 1px solid #ccc;
    padding: 8mm;
    margin: 3mm;
    break-inside: avoid;
  }
}

.header-actions .button[data-action="shell:actions-menu"] {
  display: inline-flex !important;
  font-size: 17px;
  padding: 5px 9px;
}
.row-action-cell {
  white-space: nowrap !important;
}
.row-action-cell .button:first-child {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-action-cell .button:last-child {
  font-size: 14px !important;
  padding: 4px !important;
  min-width: 24px;
}
.table-inline-tools {
  display: flex;
  gap: 6px;
  min-width: 0;
}
.table-inline-tools .button {
  font-size: 10px;
}
.dialog-scroll > [data-table] {
  height: min(480px, 55dvh);
  min-height: 140px;
  flex: 0 0 auto;
}
.drawer-body.dialog-scroll:has(> [data-table]:only-child) {
  overflow: hidden;
}
.drawer-body.dialog-scroll > [data-table]:only-child {
  height: 100%;
  min-height: 0;
  flex: 1;
}
.dialog-scroll:has(> [data-table]) {
  display: flex;
  flex-direction: column;
}
.json-details {
  white-space: pre-wrap;
}
.header-tabs .section-select {
  height: 33px;
}

.drawer-tabs > .select-control {
  width: 100%;
  max-width: none;
  flex: 1;
  min-height: 34px;
}
.drawer-footer .button {
  min-width: 0;
}
.drawer-footer {
  overflow: hidden;
}
.quick-list > .button {
  white-space: normal;
  text-align: left;
  justify-content: flex-start;
}
.tool-window > [hidden] {
  display: none !important;
}

.tool-window > * {
  flex-shrink: 0 !important;
}
.tool-window .input-wrap input {
  flex: 1;
  min-width: 0;
}
.mobile-row-data .report-item {
  align-items: flex-start;
  gap: 12px;
}
.mobile-row-data .report-item > span {
  flex: 0 0 30%;
  color: var(--muted);
  font-size: 11px;
}
.mobile-row-data .report-item > div {
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.mobile-row-data .button {
  margin: 3px;
}
.mobile-detail-cell {
  width: 90px !important;
  text-align: right !important;
}
@media (max-width: 480px) {
  .topbar[data-view="inventory"] .header-actions .button:first-child {
    width: 30px;
    min-width: 30px;
    font-size: 0;
    padding: 6px;
  }
  .topbar[data-view="inventory"] .header-actions .button:first-child::before {
    content: attr(data-icon);
    font-size: 19px;
  }
  .table-viewport th,
  .table-viewport td {
    white-space: normal;
  }
  .mobile-detail-cell .button {
    font-size: 10px !important;
    white-space: nowrap !important;
  }
}

/* Form surfaces share the same rhythm in account and everyday dialogs. */
.modal {
  border-radius: 18px;
  border-color: color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 24px 80px rgba(18, 23, 39, 0.2);
}
.modal .modal-head {
  padding: 22px 24px 18px;
  gap: 18px;
}
.modal .modal-title {
  flex: 1;
  min-width: 0;
}
.modal .modal-head h2 {
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -0.025em;
}
.modal .modal-head .form-description {
  margin: 8px 0 0;
  max-width: 46ch;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.modal .form-progress {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 9px 0 0;
  font-size: 11px;
}
.form-progress span {
  color: var(--muted);
  white-space: nowrap;
}
.form-progress b {
  color: var(--ink);
  font-size: 12px;
  font-weight: 550;
}
.modal .modal-close {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 9px;
  background: transparent;
}
.modal .modal-close:hover {
  color: var(--ink);
  background: var(--surface-soft);
}
.modal .modal-body {
  padding: 22px 24px;
}
#konturForm,
.modal .dialog-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.modal [hidden] {
  display: none !important;
}
.modal .field {
  margin-bottom: 18px;
}
.modal .field:last-child {
  margin-bottom: 0;
}
.modal .field > label {
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.4;
  color: var(--ink);
}
.modal .field input:not([type="checkbox"]):not([type="hidden"]),
.modal .field select,
.modal .field textarea {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  padding: 10px 12px;
}
.modal .field input:not([type="checkbox"]):not([type="hidden"]),
.modal .field select {
  min-height: 42px;
}
.modal .field input::placeholder,
.modal .field textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.modal .field input:focus,
.modal .field select:focus,
.modal .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal .field input:disabled,
.modal .field select:disabled,
.modal .field textarea:disabled {
  color: var(--muted);
  background: var(--surface-soft);
}
.modal .checkbox-field {
  justify-content: flex-start;
  flex-direction: row-reverse;
  min-height: 32px;
}
.modal .checkbox-field > label {
  margin: 0 auto 0 0;
  font-weight: 450;
}
.modal .field-help,
.form-draft-status {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.form-draft-status {
  margin-top: 9px;
}
.modal .modal-foot {
  padding: 16px 24px;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface);
}
.modal .modal-foot .button {
  min-height: 38px;
  min-width: 0;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 12px;
  white-space: normal;
  word-break: normal;
}
.form-actions [data-form-cancel] {
  margin-right: auto;
}
.form-actions .button-primary {
  min-width: 104px !important;
}
.form-actions [data-form-discard] {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  padding-left: 8px !important;
  padding-right: 8px !important;
}
.form-actions [data-form-discard]:hover {
  color: var(--ink);
  background: var(--surface-soft);
}
#modal[data-appearance="auth"] {
  width: min(440px, calc(100vw - 32px));
}
#modal[data-appearance="account"] {
  width: min(480px, calc(100vw - 32px));
}
.otp-digits {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  max-width: 342px;
}
#modal .otp-digits input,
.otp-digits input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  height: 48px;
  padding: 8px 0;
  border-radius: 10px;
  font-size: 23px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  caret-color: var(--accent);
}
.otp-field .field-help {
  margin-top: 10px;
  max-width: 38ch;
}
.table-panel.table-scroll > .table-viewport {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.table-scroll > .table-viewport thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
}
.table-scroll .table-group-row,
.table-scroll .table-group-row:hover {
  background: var(--surface);
}
.table-scroll .table-group-row > td {
  width: auto !important;
  padding: 20px 16px 10px;
  border-top: 0;
  text-align: right;
}
.table-group-heading {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}
.table-group-title {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}
.table-scroll-footer {
  flex-shrink: 0;
  min-height: 44px;
  gap: 12px;
}
.table-scroll-footer > span {
  color: var(--muted);
  font-size: 11px;
}
.table-scroll-footer .button {
  min-height: 30px;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .modal .modal-head {
    padding: 19px 18px 15px;
  }
  .modal .modal-body {
    padding: 19px 18px;
  }
  .modal .modal-foot {
    padding: 13px 18px;
  }
  .modal .modal-head h2 {
    font-size: 18px;
  }
  .modal .field input:not([type="checkbox"]):not([type="hidden"]),
  .modal .field select,
  .modal .field textarea {
    font-size: 16px;
  }
  #modal .otp-digits input {
    font-size: 22px;
    height: 46px;
    min-height: 46px;
  }
  .otp-digits {
    gap: 7px;
  }
  .form-actions [data-form-discard] {
    order: 3;
    flex-basis: 100%;
    margin: 0;
    justify-content: center;
  }
}
