/* HHQ N137: shared admin controls only. Intentionally not loaded by public schedule pages.
   Rendering semantics, href, form methods, names, IDs and event hooks are unchanged. */
@media screen {
  .schedule-editor,
  body.upravni-pregled-page {
    --ksc-action-color: #164c82;
    --ksc-action-ink: #123c65;
    --ksc-action-border: #a9c6df;
    --ksc-action-bg: #edf4fb;
    --ksc-focus-color: #b76009;
  }

  /* Action links remain anchors; bring their click area in line with CMS buttons. */
  .schedule-editor :is(
    #lesson-reopen,
    #class-department-list tbody a,
    #class-rename-form > a,
    #registry-list tbody a,
    #registry-form > a,
    .registry-links a,
    .overlap-filter a,
    #overlap-groups .overlap-lessons a,
    .d86-heading > a,
    .backup-verify-link,
    .backup-restore-link
  ) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 40px;
    padding: 7px 12px;
    border: 1px solid var(--ksc-action-border);
    border-radius: 7px;
    background: var(--ksc-action-bg);
    color: var(--ksc-action-color);
    font: inherit;
    font-weight: 650;
    line-height: 1.4;
    text-decoration: none;
    text-align: center;
    overflow-wrap: break-word;
    vertical-align: middle;
  }
  .schedule-editor :is(
    #lesson-reopen,
    #class-department-list tbody a,
    #class-rename-form > a,
    #registry-list tbody a,
    #registry-form > a,
    .registry-links a,
    .overlap-filter a,
    #overlap-groups .overlap-lessons a,
    .d86-heading > a,
    .backup-verify-link,
    .backup-restore-link
  ):hover {
    background: #dbeaf8;
    border-color: #82acce;
    color: var(--ksc-action-ink);
    text-decoration: none;
  }
  .schedule-editor :is(
    #lesson-reopen,
    #class-department-list tbody a,
    #class-rename-form > a,
    #registry-list tbody a,
    #registry-form > a,
    .registry-links a,
    .overlap-filter a,
    #overlap-groups .overlap-lessons a,
    .d86-heading > a,
    .backup-verify-link,
    .backup-restore-link
  ):active { background: #c7dff3; }
  .schedule-editor :is(.overlap-filter a, .registry-links a)[aria-current="page"] {
    background: var(--ksc-action-color);
    color: #fff;
    border-color: var(--ksc-action-color);
  }
  .schedule-editor :is(
    #lesson-reopen,
    #class-department-list tbody a,
    #class-rename-form > a,
    #registry-list tbody a,
    #registry-form > a,
    .registry-links a,
    .overlap-filter a,
    #overlap-groups .overlap-lessons a,
    .d86-heading > a,
    .backup-verify-link,
    .backup-restore-link
  ):focus-visible {
    outline: 3px solid var(--ksc-focus-color);
    outline-offset: 2px;
  }
  .schedule-editor :is(.overlap-filter, .registry-links) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .schedule-editor .registry-links {gap:8px;}
  .schedule-editor #overlap-groups,
  .schedule-editor #overlap-groups .overlap-group,
  .schedule-editor #overlap-groups li { min-width: 0; overflow-wrap: anywhere; }
  .schedule-editor #overlap-groups .overlap-group {
    margin-block: 14px;
    padding: 14px;
    border: 1px solid #d1dfed;
    border-radius: 10px;
    background: #f8fbfe;
  }
  .schedule-editor #overlap-groups .overlap-lessons { padding-inline-start: 22px; }

  /* Preserve each form's method and handler. Improve only controls with reported issues. */
  .schedule-editor :is(
    #class-search, #class-rename-form, #registry-form, #lesson-form,
    .d83-list-tools, .d83-pagination, .d86-actions, .n135-actions,
    .n135-row-actions, #d86-exam-list, #class-department-list
  ) button:not(.d86-time-trigger),
  .schedule-editor .admin-navigation #logout {
    max-width: 100%;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #164c82;
    border-radius: 7px;
    background: #164c82;
    color: #fff;
    font: inherit;
    font-weight: 650;
    line-height: 1.4;
    white-space: normal;
    text-align: center;
    overflow-wrap: normal;
    cursor: pointer;
  }
  .schedule-editor :is(
    #class-search, #class-rename-form, #registry-form, #lesson-form,
    .d83-list-tools, .d83-pagination, .d86-actions, .n135-actions,
    .n135-row-actions, #d86-exam-list, #class-department-list
  ) button:not(.d86-time-trigger):hover:not(:disabled),
  .schedule-editor .admin-navigation #logout:hover:not(:disabled) {
    background: #103b64;
    border-color: #103b64;
  }
  .schedule-editor :is(
    #class-search, #class-rename-form, #registry-form, #lesson-form,
    .d83-list-tools, .d83-pagination, .d86-actions, .n135-actions,
    .n135-row-actions, #d86-exam-list, #class-department-list
  ) button:not(.d86-time-trigger):active:not(:disabled),
  .schedule-editor .admin-navigation #logout:active:not(:disabled) {
    background: #0c2d4c;
  }
  .schedule-editor button:disabled { opacity: .56; cursor: not-allowed; }
  .schedule-editor :is(button, input, select, textarea):focus-visible,
  .schedule-editor .admin-navigation a:focus-visible {
    outline: 3px solid var(--ksc-focus-color);
    outline-offset: 2px;
  }
  .schedule-editor :is(#class-search, #class-rename-form) {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
  }
  .schedule-editor #class-search label { flex: 1 1 240px; min-width: 0; margin: 0; }
  .schedule-editor #class-rename-form .fields { flex: 1 1 260px; min-width: 0; }
  .schedule-editor :is(#class-search, #class-rename-form) > button { flex: 0 1 auto; }
  .schedule-editor :is(#class-department-list, #registry-list) th:last-child,
  .schedule-editor :is(#class-department-list, #registry-list) td:last-child { min-width: 125px; }
  .schedule-editor :is(input, select, textarea)[aria-invalid="true"] {
    border: 2px solid #b42318 !important;
    box-shadow: 0 0 0 1px #b42318;
  }
  .schedule-editor .cms-field-error,
  .schedule-editor #registry-name-error,
  .schedule-editor #class-name-error {
    display:block;
    margin-top:5px;
    color:#b42318;
    font-weight:650;
    line-height:1.45;
  }
  .schedule-editor #settings-form .cms-field-error { display:block; box-sizing:border-box; width:100%; max-width:100%; }
  .schedule-editor .table-scroll:has(> #class-department-list) {max-width:100%;}
  .schedule-editor .duplicate-name-warning {
    display:inline-flex;
    box-sizing:border-box;
    max-width:100%;
    white-space:nowrap !important;
    overflow-wrap:normal;
    align-items:center;
    margin-top:6px;
    padding:2px 10px;
    border:1px solid #FCD34D;
    border-radius:999px;
    background:#FEF3C7;
    color:#92400E;
    font-size:0.8125rem;
    font-weight:600;
    line-height:1.4;
  }
  .schedule-editor .registry-record-name {display:block;}
  @media(max-width:640px) {
    .schedule-editor .table-scroll:has(> #class-department-list) {
      max-width:100%;
      overflow-x:hidden;
      padding:0;
    }
    .schedule-editor #class-department-list {display:block; width:100%; table-layout:auto;}
    .schedule-editor #class-department-list thead {display:none;}
    .schedule-editor #class-department-list tbody {display:grid; gap:10px; min-width:0;}
    .schedule-editor #class-department-list tbody tr:not([hidden]) {
      display:grid;
      grid-template-columns:minmax(0,1fr);
      min-width:0;
      gap:8px;
      padding:14px;
      border:1px solid #cbddec;
      border-radius:12px;
      background:#fff;
    }
    .schedule-editor #class-department-list td,
    .schedule-editor #class-department-list th {min-width:0; width:auto; padding:0; border:0; background:transparent;}
    .schedule-editor #class-department-list td:nth-child(2)::before {content:'Број часова: '; font-weight:650;}
    .schedule-editor #class-department-list td:last-child {display:flex; min-width:0; padding-top:0;}
    .schedule-editor #class-department-list td:last-child a {
      box-sizing:border-box;
      flex:1 1 0;
      min-width:0;
      min-height:44px;
    }
  }
  .schedule-editor .admin-navigation nav a { min-height: 38px; display: inline-flex; align-items: center; }
  .schedule-editor .admin-navigation #logout {
    margin: 2px 6px 4px;
    background: #e7f1fc;
    color: #123c65;
    border-color: #bfd7ec;
  }
  .schedule-editor .admin-navigation #logout:hover:not(:disabled) {
    background: #d4e8f8;
    color: #123c65;
    border-color: #9abfdf;
  }

  /* Occupancy uses the same Node process but has its own top-level HTML template. */
  body.upravni-pregled-page { max-width: 100%; overflow-x: clip; }
  body.upravni-pregled-page .admin-navigation {
    background: linear-gradient(120deg, #102e51, #164d7f);
    border: 1px solid #244f78;
    border-radius: 12px;
    color: #fff;
  }
  body.upravni-pregled-page .admin-navigation .d83-nav-toggle {
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #bfd7ec;
    border-radius: 7px;
    background: #e7f1fc;
    color: #123c65;
    font: inherit;
    font-weight: 650;
    line-height: 1.35;
    cursor: pointer;
  }
  body.upravni-pregled-page .admin-navigation .d83-nav-toggle:hover {
    background: #d4e8f8;
  }
  body.upravni-pregled-page .admin-navigation nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #e8f2ff;
    text-decoration: none;
  }
  body.upravni-pregled-page .admin-navigation nav a:hover { background: rgba(255,255,255,.14); }
  body.upravni-pregled-page .admin-navigation nav a[aria-current="page"] {
    background: #fff;
    color: #123c65;
    text-decoration: none;
  }
  body.upravni-pregled-page .admin-navigation > p { color: #e2efff; }
  body.upravni-pregled-page .admin-navigation :is(a,button):focus-visible,
  body.upravni-pregled-page .upravni-pregled :is(button,select,input):focus-visible {
    outline: 3px solid var(--ksc-focus-color);
    outline-offset: 2px;
  }
  body.upravni-pregled-page .upravni-pregled__controls {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
  }
  body.upravni-pregled-page .upravni-pregled__controls > * { min-width: 0; }
  body.upravni-pregled-page .upravni-pregled__control-group label {
    min-height: 36px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.upravni-pregled-page .upravni-pregled__field select {
    min-width: 0;
    min-height: 42px;
    max-width: 100%;
  }
  body.upravni-pregled-page :is(
    .upravni-pregled__apply-button, .upravni-pregled__print-button,
    .upravni-pregled__modal-print-button, .upravni-pregled__modal-close-button
  ) {
    min-height: 42px;
    max-width: 100%;
    border-radius: 7px;
    padding: 9px 13px;
    background: #1e5fa8;
    color: #fff;
    border: 1px solid #1e5fa8;
    font: inherit;
    font-weight: 650;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
  }
  body.upravni-pregled-page :is(
    .upravni-pregled__apply-button, .upravni-pregled__print-button,
    .upravni-pregled__modal-print-button, .upravni-pregled__modal-close-button
  ):hover:not(:disabled) { background: #164c82; border-color: #164c82; }
  body.upravni-pregled-page :is(
    .upravni-pregled__apply-button, .upravni-pregled__print-button,
    .upravni-pregled__modal-print-button, .upravni-pregled__modal-close-button
  ):active:not(:disabled) { background: #103b64; }
  body.upravni-pregled-page :is(
    .upravni-pregled__apply-button, .upravni-pregled__print-button,
    .upravni-pregled__modal-print-button, .upravni-pregled__modal-close-button
  ):disabled { opacity: .56; cursor: not-allowed; }
  body.upravni-pregled-page .upravni-pregled__print-actions {
    min-width: 0;
    max-width: 100%;
  }
  body.upravni-pregled-page .upravni-pregled__grid { min-width: 0; }
  @media (max-width: 1100px) {
    body.upravni-pregled-page .upravni-pregled__controls {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  @media (max-width: 620px) {
    body.upravni-pregled-page { padding: 8px; }
    body.upravni-pregled-page .upravni-pregled { padding: 9px; }
    body.upravni-pregled-page .upravni-pregled__controls { grid-template-columns: minmax(0, 1fr); }
    body.upravni-pregled-page .upravni-pregled__controls .upravni-pregled__actions,
    body.upravni-pregled-page .upravni-pregled__apply-button { width: 100%; }
    body.upravni-pregled-page .upravni-pregled__control-group label { flex: 1 1 120px; }
  }
}

/* D16 R2: one shared contract for every CMS form and table. */
@media screen {
  .schedule-editor .table-scroll,
  body.upravni-pregled-page .table-scroll { box-sizing:border-box; width:100%; max-width:100%; min-width:0; overflow-x:auto; border:0; border-radius:0; padding:0; }
  .schedule-editor .table-scroll > table,
  body.upravni-pregled-page .table-scroll > table { box-sizing:border-box; width:100%; max-width:100%; min-width:0; border-collapse:collapse; table-layout:auto; }
  .schedule-editor .table-scroll > table thead th,
  body.upravni-pregled-page .table-scroll > table thead th { padding:.7rem .75rem; background:#eaf2f9; color:#17314b; font-weight:700; text-align:left; vertical-align:top; border-bottom:2px solid #a9c6df; }
  .schedule-editor .table-scroll > table tbody td,
  body.upravni-pregled-page .table-scroll > table tbody td { box-sizing:border-box; min-width:0; padding:.65rem .75rem; vertical-align:top; overflow-wrap:break-word; word-break:normal; }
  .schedule-editor .table-scroll > table tbody tr + tr td,
  body.upravni-pregled-page .table-scroll > table tbody tr + tr td { border-top:1px solid #dbe3e9; }
  .schedule-editor .table-scroll > table:has(tbody td:last-child button) :is(th:last-child,td:last-child),
  .schedule-editor .table-scroll > table:has(tbody td:last-child a) :is(th:last-child,td:last-child) { width:1%; white-space:nowrap; }
  .schedule-editor .table-scroll > table td:last-child :is(button,a),
  body.upravni-pregled-page .table-scroll > table td:last-child :is(button,a) { vertical-align:top; }
  .schedule-editor .table-scroll > table :is(th,td),
  body.upravni-pregled-page .table-scroll > table :is(th,td) { vertical-align:top; word-break:normal; overflow-wrap:break-word; }
  .schedule-editor .table-scroll > table :is(th,td) :is(button,a),
  body.upravni-pregled-page .table-scroll > table :is(th,td) :is(button,a) { vertical-align:top; }
  .schedule-editor .table-scroll > table:has(tbody td[colspan]) thead,
  body.upravni-pregled-page .table-scroll > table:has(tbody td[colspan]) thead { display:none; }
  .schedule-editor .table-scroll > table tbody td[colspan],
  body.upravni-pregled-page .table-scroll > table tbody td[colspan] { padding:1.5rem; color:#64748b; text-align:center; background:#f8fafc; }
  .schedule-editor .table-scroll > table tbody td a,
  .schedule-editor .table-scroll > table tbody td button { overflow-wrap:normal; word-break:normal; }
  .schedule-editor :is(#lesson-delete,#remove-account-form button[type=submit],[data-n135-remove],[data-delete-id],[data-archive-notice]),
  body.upravni-pregled-page :is(#lesson-delete,#remove-account-form button[type=submit],[data-n135-remove],[data-delete-id],[data-archive-notice]) { min-height:44px; border:1px solid #bd7373; border-radius:7px; background:#fff2f2; color:#8a2222; font-weight:700; }
  .schedule-editor #registry-list button.registry-delete { min-height:44px; margin-left:8px; border-color:#bd7373; background:#fff2f2; color:#8a2222; font-weight:700; }
  .schedule-editor :is([data-delete-id],[data-archive-notice],[data-delete-account],[data-remove-account]) { min-height:44px; border:1px solid #bd7373; border-radius:7px; background:#fff2f2; color:#8a2222; font-weight:700; }
  .schedule-editor :is(#lesson-delete,#remove-account-form button[type=submit],[data-n135-remove],[data-delete-id],[data-archive-notice]):hover,
  body.upravni-pregled-page :is(#lesson-delete,#remove-account-form button[type=submit],[data-n135-remove],[data-delete-id],[data-archive-notice]):hover { background:#ffe3e3; }
  .schedule-editor form label:has(input[type=checkbox]),
  .schedule-editor label.check,
  .schedule-editor label.d86-check,
  .schedule-editor label.d88-checkbox { box-sizing:border-box; min-height:44px; align-items:center; }
  @media (max-width:640px) {
    .schedule-editor .table-scroll,
    body.upravni-pregled-page .table-scroll { overflow:visible; border:0; padding:0; }
    .schedule-editor .table-scroll > table,
    body.upravni-pregled-page .table-scroll > table { display:block; width:100%; table-layout:auto; border:0; }
    .schedule-editor .table-scroll > table thead,
    body.upravni-pregled-page .table-scroll > table thead { display:none; }
    .schedule-editor .table-scroll > table tbody,
    body.upravni-pregled-page .table-scroll > table tbody { display:grid; gap:10px; min-width:0; }
    .schedule-editor .table-scroll > table tbody tr:not(:has(td[colspan])),
    body.upravni-pregled-page .table-scroll > table tbody tr:not(:has(td[colspan])) { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; min-width:0; padding:14px; border:1px solid #cbddec; border-radius:12px; background:#fff; }
    .schedule-editor .table-scroll > table tbody td,
    body.upravni-pregled-page .table-scroll > table tbody td { display:grid; grid-template-columns:minmax(0,1fr); gap:3px; width:auto; min-width:0; padding:0; border:0; background:transparent; white-space:normal; overflow-wrap:break-word; word-break:normal; }
    .schedule-editor .table-scroll > table tbody td.d86-note-cell:empty,
    body.upravni-pregled-page .table-scroll > table tbody td.d86-note-cell:empty { display:none; }
    .schedule-editor .table-scroll > table tbody td::before,
    body.upravni-pregled-page .table-scroll > table tbody td::before { content:attr(data-label); display:block; color:#475569; font-weight:700; white-space:nowrap; }
    .schedule-editor .table-scroll > table tbody td:last-child:has(button,a),
    body.upravni-pregled-page .table-scroll > table tbody td:last-child:has(button,a) { display:flex; flex-wrap:wrap; gap:8px; width:auto; min-width:0; white-space:normal; }
    .schedule-editor .table-scroll > table tbody td:last-child:has(button,a)::before,
    body.upravni-pregled-page .table-scroll > table tbody td:last-child:has(button,a)::before { display:block; flex:0 0 100%; }
    .schedule-editor .table-scroll > table tbody td:last-child:has(div button),
    body.upravni-pregled-page .table-scroll > table tbody td:last-child:has(div button) { display:block; }
    .schedule-editor .table-scroll > table tbody td:last-child div:has(>button),
    body.upravni-pregled-page .table-scroll > table tbody td:last-child div:has(>button) { display:flex; flex-wrap:nowrap; gap:8px; min-width:0; }
    .schedule-editor .table-scroll > table tbody td:last-child :is(button,a),
    body.upravni-pregled-page .table-scroll > table tbody td:last-child :is(button,a) { box-sizing:border-box; flex:1 1 0; min-width:0; min-height:44px; white-space:normal; }
    .schedule-editor .table-scroll > table tbody td[colspan],
    body.upravni-pregled-page .table-scroll > table tbody td[colspan] { display:block; text-align:center; padding:1.5rem; }
    .schedule-editor .table-scroll > table tbody td:last-child:has(button) { white-space:normal; }
    .schedule-editor form:not(.admin-navigation form) > :is(button[type=submit],button[type=button]),
    .schedule-editor form .d86-actions > button,
    .schedule-editor form .d88-actions > button,
    .schedule-editor form .n135-actions > button { box-sizing:border-box; min-width:0; min-height:44px; }
    .schedule-editor form:has(> button[type=submit]) { display:flex; flex-wrap:wrap; gap:8px; }
    .schedule-editor form:has(> button[type=submit]) > button { flex:1 1 100%; width:100%; }
    .schedule-editor form button[type=submit] { box-sizing:border-box; flex:1 1 100%; width:100%; min-width:0; min-height:44px; }
    .schedule-editor :is(.d86-actions,.d88-actions,.n135-actions) { display:flex; flex-wrap:wrap; gap:8px; }
    .schedule-editor :is(.d86-actions,.d88-actions,.n135-actions) > button { flex:1 1 100%; width:100%; }
    .schedule-editor :is(.d83-list-tools,.registry-list-tools,#class-search,.d134-list-controls) > button { box-sizing:border-box; display:block; width:100%; min-width:0; min-height:44px; }
    .schedule-editor form label:has(input[type=checkbox]),
    .schedule-editor label.check,
    .schedule-editor label.d86-check,
    .schedule-editor label.d88-checkbox { display:flex; width:100%; min-height:44px; gap:10px; padding:6px 0; }
    .schedule-editor :is(input[type=checkbox],input[type=radio]) { flex:0 0 22px; width:22px; height:22px; }
  }
}

/* D22 R4: medium cards repeat the mobile card declarations verbatim. */
@media screen and (min-width:641px) and (max-width:1024px) {
  .schedule-editor .table-scroll--cards-medium,
  body.upravni-pregled-page .table-scroll--cards-medium { overflow:visible; border:0; padding:0; }
  .schedule-editor .table-scroll--cards-medium > table,
  body.upravni-pregled-page .table-scroll--cards-medium > table { display:block; width:100%; table-layout:auto; border:0; }
  .schedule-editor .table-scroll--cards-medium > table thead,
  body.upravni-pregled-page .table-scroll--cards-medium > table thead { display:none; }
  .schedule-editor .table-scroll--cards-medium > table tbody,
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody { display:grid; gap:10px; min-width:0; }
  .schedule-editor .table-scroll--cards-medium > table tbody tr:not(:has(td[colspan])),
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody tr:not(:has(td[colspan])) { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; min-width:0; padding:14px; border:1px solid #cbddec; border-radius:12px; background:#fff; }
  .schedule-editor .table-scroll--cards-medium > table tbody td,
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td { display:grid; grid-template-columns:minmax(0,1fr); gap:3px; width:auto; min-width:0; padding:0; border:0; background:transparent; white-space:normal; overflow-wrap:break-word; word-break:normal; }
  .schedule-editor .table-scroll--cards-medium > table tbody td.d86-note-cell:empty,
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td.d86-note-cell:empty { display:none; }
  .schedule-editor .table-scroll--cards-medium > table tbody td::before,
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td::before { content:attr(data-label); display:block; color:#475569; font-weight:700; white-space:nowrap; }
  .schedule-editor .table-scroll--cards-medium > table tbody td:last-child:has(button,a),
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td:last-child:has(button,a) { display:flex; flex-wrap:wrap; gap:8px; width:auto; min-width:0; white-space:normal; }
  .schedule-editor .table-scroll--cards-medium > table tbody td:last-child:has(button,a)::before,
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td:last-child:has(button,a)::before { display:block; flex:0 0 100%; }
  .schedule-editor .table-scroll--cards-medium > table tbody td:last-child:has(div button),
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td:last-child:has(div button) { display:block; }
  .schedule-editor .table-scroll--cards-medium > table tbody td:last-child div:has(>button),
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td:last-child div:has(>button) { display:flex; flex-wrap:nowrap; gap:8px; min-width:0; }
  .schedule-editor .table-scroll--cards-medium > table tbody td:last-child :is(button,a),
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td:last-child :is(button,a) { box-sizing:border-box; flex:1 1 0; min-width:0; min-height:44px; white-space:normal; }
  .schedule-editor .table-scroll--cards-medium > table tbody td[colspan],
  body.upravni-pregled-page .table-scroll--cards-medium > table tbody td[colspan] { display:block; text-align:center; padding:1.5rem; }
  .schedule-editor .table-scroll--cards-medium > table tbody td:last-child:has(button) { white-space:normal; }
  :where(.schedule-editor,.occupancy-application) .table-scroll--cards-medium > table tbody td{width:auto!important;max-width:none!important;white-space:normal}
}

/* D16 mobile layout contract is scoped to CMS surfaces; button colors are class-owned. */
@media screen {
  .schedule-editor .d16-date,
  body.upravni-pregled-page .d16-date { white-space:nowrap; }
  @media (max-width:640px) {
    .schedule-editor :is(form,fieldset,.fields),
    body.upravni-pregled-page .upravni-pregled :is(form,fieldset) { box-sizing:border-box; width:100%; max-width:100%; min-width:0; }
    .schedule-editor form :is(input:not([type=checkbox]):not([type=radio]),select,textarea),
    body.upravni-pregled-page .upravni-pregled :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { box-sizing:border-box; width:100%; max-width:100%; min-width:0; }
    .schedule-editor .table-scroll > table tbody tr:not(:has(td[colspan])) > td,
    body.upravni-pregled-page .table-scroll > table tbody tr:not(:has(td[colspan])) > td,
    .schedule-editor #accounts-table tbody tr:not([hidden]) > td { border:0 !important; }
    .schedule-editor .table-scroll > table tbody tr:not(:has(td[colspan])) > td:not(:first-child),
    body.upravni-pregled-page .table-scroll > table tbody tr:not(:has(td[colspan])) > td:not(:first-child),
    .schedule-editor #accounts-table tbody tr:not([hidden]) > td:not(:first-child) { border:0 !important; border-top:1px solid #dbe3e9 !important; padding-top:8px; }
    .schedule-editor :is(.d88-row-actions,.n135-row-actions) { display:flex; flex-wrap:nowrap; align-items:center; gap:8px; min-width:0; width:100%; }
    .schedule-editor :is(.d88-row-actions,.n135-row-actions) > button { box-sizing:border-box; flex:0 0 auto !important; width:auto !important; min-width:max-content !important; min-height:44px; padding:8px 12px; white-space:nowrap; }
    .schedule-editor form button[type=submit],
    body.upravni-pregled-page .upravni-pregled form button[type=submit] { box-sizing:border-box; width:100%; max-width:100%; min-width:0; min-height:44px; flex:1 1 100%; }
  }
}

/* One positive button contract; :where keeps the selector weight to one class. */
.cms-btn--primary:not(.d86-time-trigger):not([role="option"]) { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:9px 16px; border:1px solid #164c82; border-radius:7px; background:#164c82; color:#fff; font:700 1rem/1.25 system-ui,Arial,sans-serif; text-decoration:none; cursor:pointer; }
.cms-btn--secondary:not(.d86-time-trigger):not([role="option"]) { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:9px 16px; border:1px solid #a9c6df; border-radius:7px; background:#edf4fb; color:#164c82; font:600 1rem/1.25 system-ui,Arial,sans-serif; text-decoration:none; cursor:pointer; }
.cms-btn--danger:not(.d86-time-trigger):not([role="option"]) { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:9px 16px; border:1px solid #bd7373; border-radius:7px; background:#fff2f2; color:#8a2222; font:700 1rem/1.25 system-ui,Arial,sans-serif; text-decoration:none; cursor:pointer; }
:where(.cms-btn--primary,.cms-btn--secondary,.cms-btn--danger):not(.d86-time-trigger):not([role="option"]):disabled { opacity:.52; filter:grayscale(.65); cursor:not-allowed; }
:where(.cms-btn--primary,.cms-btn--secondary,.cms-btn--danger):not(.d86-time-trigger):not([role="option"]):focus-visible { outline:3px solid #76b6ef; outline-offset:2px; }
@media (max-width:640px) {
  :where(.schedule-editor,.occupancy-application) form .cms-btn--primary:not(.d86-time-trigger):not([role="option"]) { box-sizing:border-box; width:100%; min-width:0; }
}

/* D16 R7 (odluka Senior Lead-a): ugovor dugmadi je jedini vlasnik boje, ivice i debljine fonta. */
.cms-btn--primary:not(.d86-time-trigger):not([role="option"]){background:#164c82!important;border-color:#164c82!important;color:#fff!important;font-weight:700!important}
.cms-btn--primary:not(.d86-time-trigger):not([role="option"]):hover{background:#10406f!important;border-color:#10406f!important}
.cms-btn--secondary:not(.d86-time-trigger):not([role="option"]){background:#edf4fb!important;border-color:#a9c6df!important;color:#164c82!important;font-weight:600!important}
.cms-btn--secondary:not(.d86-time-trigger):not([role="option"]):hover{background:#dcebf8!important}
.cms-btn--danger:not(.d86-time-trigger):not([role="option"]){background:#fff2f2!important;border-color:#bd7373!important;color:#8a2222!important;font-weight:700!important}
.cms-btn--danger:not(.d86-time-trigger):not([role="option"]):hover{background:#ffe3e3!important}
@media (max-width:640px){
  :where(.schedule-editor,.occupancy-application) .cms-btn--primary:not(.d86-time-trigger):not([role="option"]){box-sizing:border-box;width:100%;min-width:0}
  :where(.occupancy-application,.upravni-pregled) label:has(input[type=radio]){white-space:nowrap;word-break:normal;overflow-wrap:normal;hyphens:none}
}

/* D16 R8 (Senior Lead): V24 izbor rezima u zauzetosti bez preloma reci; V25 kolona radnji u mobilnim karticama pune sirine; V26 meni dugme iste tezine na svim stranicama. */
@media (max-width:640px){
  .occupancy-application .upravni-pregled__control-group{display:flex!important;flex-wrap:wrap!important;gap:8px!important}
  .occupancy-application .upravni-pregled__control-group label:has(input[type=radio]){flex:0 0 auto!important;width:auto!important;white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;hyphens:none!important}
  :where(.schedule-editor,.occupancy-application) table tbody td{width:auto!important;max-width:none!important}
}
body.upravni-pregled-page .d83-nav-toggle{font-weight:400!important}

/* D02-7: kontrast listbox predloga u zavrsnoj CMS kaskadi. */
@media screen {
  body #lesson-form .lesson-class-picker__options [role="option"]:not(:disabled) { background-color:#f2f7fc!important; color:#173b5e!important; }
  body #lesson-form .lesson-class-picker__options [role="option"]:hover:not(:disabled) { background-color:#dcecfb!important; color:#123657!important; }
  body #lesson-form .lesson-class-picker__options [role="option"]:focus-visible:not(:disabled) { background-color:#dcecfb!important; color:#123657!important; }
  body #lesson-form .lesson-class-picker__options [role="option"][aria-selected="true"]:not(:disabled) { background-color:#dcecfb!important; color:#123657!important; }
  body .d86-time-popover [role="option"] { background-color:#f2f7fc!important; color:#173b5e!important; }
  body .d86-time-popover [role="option"]:hover { background-color:#dcecfb!important; color:#123657!important; }
  body .d86-time-popover [role="option"].d86-option-active { background-color:#dcecfb!important; color:#123657!important; }
  body .d86-time-popover [role="option"]:focus-visible { background-color:#dcecfb!important; color:#123657!important; }
  body .d86-time-popover [role="option"][aria-selected="true"] { background-color:#dcecfb!important; color:#123657!important; }
}
