/* D83-B: visual workspace, task-oriented forms and mobile administration. */
:root{--d83-blue:#164c82;--d83-ink:#17314b;--d83-soft:#eaf2f9;--d83-border:#c9d9e8}
.schedule-editor{max-width:1380px;margin:14px auto;padding:clamp(14px,2vw,28px);border-left-width:0;box-shadow:0 12px 36px rgba(23,54,87,.07)}
.schedule-editor>h1{font-family:system-ui,Arial,sans-serif;font-size:clamp(23px,2.3vw,31px);letter-spacing:-.03em;color:var(--d83-ink)}
.d83-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0}
.d83-stat{background:#f1f6fb;border:1px solid var(--d83-border);border-radius:12px;padding:15px;min-width:0}
.d83-stat strong{display:block;color:var(--d83-blue);font-size:clamp(22px,2.6vw,30px);line-height:1.2}
.d83-stat span{display:block;color:#445b70;font-size:13px;margin-top:5px}
.d83-work-area,.d83-list-area{border:1px solid var(--d83-border);background:#fff;border-radius:14px;padding:clamp(12px,2vw,22px);margin:18px 0;box-shadow:0 3px 16px rgba(23,54,87,.045)}
.d83-work-area h2,.d83-list-area h2{font-size:21px;margin:0 0 14px;color:var(--d83-ink)}
.d83-list-tools{display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin:10px 0 14px}
.d83-list-tools label{flex:1 1 225px;margin:0}
.d83-list-tools select{min-width:140px}
.d83-pagination{display:flex;flex-wrap:wrap;align-items:center;gap:9px;margin:14px 0}
.d83-pagination [data-d83-page]{background:#f0f5fb;color:var(--d83-blue);border:1px solid #a5c0db}
.d83-pagination [data-d83-page][disabled]{opacity:.52}
.d83-pagination output{font-size:14px;color:#334e68}
.d83-selected-teachers{min-height:32px;padding:8px 12px;border-radius:8px;background:var(--d83-soft);color:var(--d83-ink);font-size:14px}
#teacher-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:4px;max-height:250px;overflow-y:auto;padding:10px;border:1px solid var(--d83-border);border-radius:9px}
#teacher-options .check{min-width:0;padding:5px 6px;margin:0;border-radius:6px}
#teacher-options .check:has(input:checked){background:#dfedfc;font-weight:600}
.admin-navigation{background:linear-gradient(120deg,#102e51,#164d7f);border-radius:12px;padding:12px;color:#fff}
.admin-navigation nav{background:transparent;border:0;padding:4px;gap:6px}
.admin-navigation nav a{color:#e8f2ff;text-decoration:none;border:1px solid transparent;border-radius:7px;padding:8px 10px;line-height:1.3}
.admin-navigation nav a:hover,.admin-navigation nav a:focus-visible{background:rgba(255,255,255,.14)}
.admin-navigation nav a[aria-current=page]{color:#123c65;background:#fff;text-decoration:none;box-shadow:0 2px 6px rgba(0,0,0,.12)}
.admin-navigation>p{font-size:13px;color:#e2efff;margin:8px 6px}
.d83-nav-toggle{display:none;background:#e7f1fc;color:#123c65;border:1px solid #d4e7fa;align-items:center;gap:10px}
.d83-nav-toggle:focus-visible{outline:3px solid #fdb65b;outline-offset:3px}
.d83-admin-state{display:inline-block;font-size:12px;font-weight:700;color:#1c5286;background:#e7f1fb;border-radius:100px;padding:4px 10px}
#lesson-list a{font-weight:600}
#lesson-list tbody tr:hover{background:#f6faff}
@media(max-width:760px){
 .d83-summary{grid-template-columns:1fr 1fr;gap:8px}
 .d83-stat{padding:11px}
 .schedule-editor{margin:8px auto}
 .d83-nav-toggle{display:inline-flex}
 body.d83-nav-ready .admin-navigation:not(.d83-nav-open) nav{display:none}
 .admin-navigation nav{display:flex;flex-direction:column;align-items:stretch}
 .admin-navigation nav a{width:100%}
 .d83-list-tools{align-items:stretch}
 .d83-list-tools label{flex:1 1 100%}
 #teacher-options{grid-template-columns:1fr}
}

@media(max-width:430px){.d83-summary{grid-template-columns:1fr 1fr}.d83-stat strong{font-size:20px}}
@media print{.d83-nav-toggle,.d83-pagination,.d83-list-tools{display:none!important}.d83-work-area,.d83-list-area{box-shadow:none}}

#teacher-options label[hidden]{display:none!important}

/* D22: clear visual hierarchy for backup warnings and secondary file metadata. */
.schedule-editor .backup-warning{margin:16px 0;padding:14px 16px;border:2px solid #a83232;border-left-width:7px;border-radius:8px;background:#fff1f1;color:#641919;font-weight:600}
.schedule-editor .backup-verification-summary{padding:14px 16px;border-left:5px solid #27734a;background:#eff8f2;color:#173f2b;font-weight:650}
.schedule-editor #backup-verification[data-ok="0"] .backup-verification-summary{border-color:#a83232;background:#fff1f1;color:#641919}
.schedule-editor .backup-file-name{display:block;margin-top:4px;color:#627486;font-size:12px;font-weight:400;overflow-wrap:break-word}
.schedule-editor .backup-empty{text-align:center;margin:26px 0;padding:18px;color:#657486;background:#f5f7f9;border-radius:8px}

/* N135-T3: only clickable day/slot values in the saved-lesson table. */
#lesson-list tbody td:first-child a.lesson-read-link{
  display:inline-block;min-height:2rem;padding:.26rem .55rem;
  color:#164c82;background:#edf4fb;border:1px solid #c8dced;
  border-radius:.45rem;text-decoration:none;font-weight:650;
  line-height:1.4;white-space:nowrap;
}
#lesson-list tbody td:first-child a.lesson-read-link:hover{
  color:#103b61;background:#dcebf8;border-color:#9cbfdd;text-decoration:none;
}
#lesson-list tbody td:first-child a.lesson-read-link:focus-visible{
  outline:3px solid #ba6500;outline-offset:2px;background:#fff;
}
@media print{
  #lesson-list tbody td:first-child a.lesson-read-link,
  #lesson-list tbody td:first-child a.lesson-read-link:hover,
  #lesson-list tbody td:first-child a.lesson-read-link:focus-visible{
    color:#111;background:transparent;border-color:transparent;box-shadow:none;
  }
}

/* YKU N137: existing HZX shared admin-control rules, no external CSS dependencies. */
@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: anywhere;
    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: 7px;
    align-items: center;
  }
  .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 .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;
  }
}


/* N137 TEST 67: structured reading layout for the selected lesson, CSS only. */
@media screen {
  #d83-editor > #lesson-read,
  #d83-editor #lesson-source-details dl {
    display: grid;
    grid-template-columns: minmax(145px, 32%) minmax(0, 1fr);
    margin: 14px 0 22px;
    border: 1px solid #c9d9e8;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(20, 58, 94, .045);
  }
  #d83-editor > #lesson-read > dt,
  #d83-editor #lesson-source-details dl > dt {
    margin: 0;
    min-width: 0;
    padding: 11px 14px;
    border-bottom: 1px solid #e2eaf2;
    background: #f0f6fc;
    color: #254966;
    font-size: .94rem;
    font-weight: 700;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  #d83-editor > #lesson-read > dd,
  #d83-editor #lesson-source-details dl > dd {
    margin: 0;
    min-width: 0;
    padding: 11px 14px;
    border-bottom: 1px solid #e2eaf2;
    color: #142e45;
    font-weight: 550;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  #d83-editor > #lesson-read > dt:last-of-type,
  #d83-editor > #lesson-read > dd:last-of-type,
  #d83-editor #lesson-source-details dl > dt:last-of-type,
  #d83-editor #lesson-source-details dl > dd:last-of-type {
    border-bottom: 0;
  }
}
@media screen and (max-width: 560px) {
  #d83-editor > #lesson-read,
  #d83-editor #lesson-source-details dl {
    grid-template-columns: minmax(100px, 39%) minmax(0, 1fr);
  }
  #d83-editor > #lesson-read > dt,
  #d83-editor > #lesson-read > dd,
  #d83-editor #lesson-source-details dl > dt,
  #d83-editor #lesson-source-details dl > dd {
    padding: 10px;
    font-size: .91rem;
  }
}


/* K5: CMS edit action group; scoped, no effect on public timetable/print. */
@media screen {
  .schedule-editor #d83-editor .lesson-edit-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin: 14px 0 10px;
  }
  .schedule-editor #d83-editor .lesson-edit-action-row > * {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    max-width: 100%;
  }
}

/* D16 table sweep: CMS data tables wrap registry labels within the wide-screen panel. */
@media screen and (min-width:1024px) {
  .schedule-editor .table-scroll > table {
    width:100%;
    min-width:0;
    max-width:100%;
    table-layout:fixed;
  }
  .schedule-editor .table-scroll > table th,
  .schedule-editor .table-scroll > table td {
    min-width:0;
    overflow-wrap:anywhere;
    word-break:normal;
  }
}


/* D19 R2 N6: kompaktan pregled školskih podataka u unosu časa. */
.schedule-editor .d19-school-settings-summary { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:16px; margin:0; }
.schedule-editor .d19-school-settings-summary dt { color:#526579; font-size:.875rem; }
.schedule-editor .d19-school-settings-summary dd { margin:0; font-weight:700; }
.schedule-editor .overlap-filter { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.schedule-editor .overlap-filter__gap { display:none; }
.schedule-editor #lesson-form fieldset:last-of-type > a { display:inline-block; margin-top:16px; }
.schedule-editor #read-only { margin:16px 0; padding:12px 14px; border:1px solid #b9c8d6; border-left:5px solid #526375; border-radius:6px; background:#f1f5f9; color:#25394b; }
@media screen and (max-width:640px) { .schedule-editor .d19-school-settings-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; } }

/* E01-4c: ekran „Увоз“; sva pravila pod korenom .csv-import, boje iz postojećih promenljivih. */
@media screen {
  .csv-import { min-width:0; max-width:100%; }
  .csv-import .csv-import-steps { margin:0; padding:14px 16px 14px 38px; border:1px solid var(--d83-border); border-left:5px solid var(--d83-blue); border-radius:8px; background:var(--d83-soft); color:var(--d83-ink); }
  .csv-import .csv-import-steps li { margin:0; padding-left:4px; line-height:1.5; overflow-wrap:break-word; }
  .csv-import .csv-import-steps li + li { margin-top:6px; }
  .csv-import .csv-import-templates { display:flex; flex-wrap:wrap; gap:12px; margin:0; padding:0; list-style:none; }
  .csv-import .csv-import-templates li { margin:0; min-width:0; }
  .csv-import .csv-import-fields { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; margin:0 0 16px; }
  .csv-import .csv-import-fields label { min-width:0; margin:0; font-weight:600; color:var(--d83-ink); }
  .csv-import .csv-import-fields :is(select,input[type=file]) { box-sizing:border-box; width:100%; max-width:100%; min-width:0; min-height:44px; margin:0; border:1px solid #9baab8; border-radius:4px; background:#fff; color:#111; font:inherit; font-weight:400; }
  .csv-import .csv-import-fields select { padding:8px; }
  .csv-import .csv-import-fields input[type=file] { padding:4px 8px 4px 4px; line-height:34px; cursor:pointer; }
  .csv-import .csv-import-fields input[type=file]::file-selector-button { min-height:34px; margin:0 12px 0 0; padding:5px 14px; border:1px solid var(--ksc-action-border); border-radius:7px; background:var(--ksc-action-bg); color:var(--ksc-action-color); font:600 1rem/1.25 system-ui,Arial,sans-serif; cursor:pointer; }
  .csv-import .csv-import-fields input[type=file]:hover::file-selector-button { background:#dcebf8; }
  .csv-import :is(a,select,input):focus-visible { outline:3px solid var(--ksc-focus-color); outline-offset:2px; }
  .csv-import .csv-import-actions { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
  .csv-import .csv-import-actions > * { margin:0; }
  /* E01-4d: rezultat uvoza — poruke i tabela grešaka iste širine (100% kartice), razmak 12 px; vrednosti iz single-lesson.css i HHQ zaglavlja. */
  .csv-import .account-form-feedback:not(:empty) { box-sizing:border-box; width:100%; max-width:100%; }
  .csv-import table { box-sizing:border-box; width:100%; max-width:100%; margin:12px 0 0; border:1px solid #dce3eb; border-collapse:separate; border-spacing:0; border-radius:5px; overflow:hidden; }
  .csv-import table :is(th,td) { padding:8px; border:0; border-left:1px solid #dce3eb; border-top:1px solid #dce3eb; text-align:left; vertical-align:top; overflow-wrap:break-word; }
  .csv-import table tr > :first-child { border-left:0; }
  .csv-import table thead th { border-top:0; border-bottom:2px solid #a9c6df; background:#eaf2f9; color:#17314b; font-weight:700; }
  .csv-import table tbody tr:first-child > td { border-top:0; }
  @media (min-width:768px) {
    .csv-import .csv-import-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  }
  @media (max-width:767px) {
    .csv-import .csv-import-actions { flex-direction:column; align-items:stretch; }
    .csv-import .csv-import-actions > * { box-sizing:border-box; width:100%; max-width:100%; min-width:0; flex:0 0 auto; }
  }
}

/* E03-3: strana „Нова школска година“; sva pravila pod korenom .school-year-rollover, vrednosti kao kod .csv-import. */
@media screen {
  .school-year-rollover { min-width:0; max-width:100%; }
  .school-year-rollover .rollover-intro { margin:0; padding:14px 16px 14px 38px; border:1px solid var(--d83-border); border-left:5px solid var(--d83-blue); border-radius:8px; background:var(--d83-soft); color:var(--d83-ink); }
  .school-year-rollover .rollover-intro li { margin:0; padding-left:4px; line-height:1.5; overflow-wrap:break-word; }
  .school-year-rollover .rollover-intro li + li { margin-top:6px; }
  .school-year-rollover .rollover-state { display:grid; grid-template-columns:max-content minmax(0,1fr); gap:8px 16px; margin:0; }
  .school-year-rollover .rollover-state dt { margin:0; color:var(--d83-ink); }
  .school-year-rollover .rollover-state dd { margin:0; font-weight:700; }
  .school-year-rollover .csv-import-templates { display:flex; flex-wrap:wrap; gap:12px; margin:0; padding:0; list-style:none; }
  .school-year-rollover .csv-import-templates li { margin:0; min-width:0; }
  .school-year-rollover :is(a,input):focus-visible { outline:3px solid var(--ksc-focus-color); outline-offset:2px; }
  .school-year-rollover .account-form-feedback:not(:empty) { box-sizing:border-box; width:100%; max-width:100%; }
}
