/* Royal CIC dashboard - V25 usability fixes (review work/UX-REVIEW-V25.md). Loaded after admin.css and teacher.css. Logical properties only. */

/* buttons never break a word in the middle (Kurdish "Save" was cut in three lines); the long-word safety net stays */
.btn, .dialog-actions .btn, .form-buttons .btn { overflow-wrap: break-word; word-break: normal; hyphens: none; }

/* compact lists on a phone: the class text may use two lines instead of being cut under the amount / status badge */
@media (max-width: 600px) {
  .cl-main .dt-sub { white-space: normal; overflow: hidden; max-block-size: 2.7em; line-height: 1.3; }   /* V25u: two lines at most, so a long note cannot make a row 200 px high */
}

/* users: one line for the permissions, the rest under "Details" / "More" */
.perm-fold > summary { display: inline-flex; align-items: center; gap: 6px; min-block-size: 44px; cursor: pointer; color: var(--blue-700); font-weight: 600; list-style: none; }
.perm-fold > summary::-webkit-details-marker { display: none; }
.perm-fold > summary .i { inline-size: 16px; block-size: 16px; transition: transform .15s; }
.perm-fold[open] > summary .i { transform: rotate(180deg); }
.perm-fold > .chips { margin-block-start: 4px; }
.row-actions .more { display: inline-block; }

/* "rate not set today" is a reminder, not an alarm: calm amber instead of red */
.fxchip--bad { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-700); }
/* small targets raised to 44 px (timetable add cell) */
.tt-add { min-block-size: 44px; }
.cls-panel .linkbtn, table .linkbtn { min-block-size: 44px; display: inline-flex; align-items: center; }

/* V25u: collapsible sections (Settings): a closed section shows only its title and one summary line */
.fold-head { cursor: pointer; display: flex; align-items: center; gap: 8px; min-block-size: 48px; user-select: none; }
legend.fold-head { display: block; padding-block: 12px; inline-size: auto; }
.fold-head::after { content: ''; display: inline-block; inline-size: 9px; block-size: 9px; border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor; transform: rotate(45deg); margin-inline-start: 10px; margin-block-end: 3px; transition: transform .15s; flex: none; }
.fold--open > .fold-head::after { transform: rotate(-135deg); margin-block-end: -3px; }
.fold-head:focus-visible { outline: 3px solid var(--blue-500, #3b82f6); outline-offset: 2px; border-radius: 6px; }
.fold-sum { margin: 0 0 var(--space-2, 8px); color: var(--text-muted, #475569); font-size: var(--text-sm, 14px); overflow-wrap: anywhere; }
.fold:not(.fold--open) > :not(.fold-head):not(.fold-sum) { display: none !important; }
.fold:not(.fold--open) { padding-block-end: var(--space-2, 8px); }
.setform > .fgroup.fold { margin-block-end: var(--space-2, 8px); }
section.admin-card.fold:not(.fold--open), form.admin-card.fold:not(.fold--open) { padding-block: var(--space-2, 8px); }

/* V25u: the backup reminder on Today is one calm line below the tasks */
.bk-calm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg, 12px); background: var(--amber-50, #fffbeb); }
.bk-calm-a { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; min-block-size: 44px; color: var(--text, #1e293b); text-decoration: none; font-weight: 600; }
.bk-calm-a .i { inline-size: 18px; block-size: 18px; color: var(--amber-700, #b45309); flex: none; }
.bk-calm-go { color: var(--blue-700); text-decoration: underline; font-weight: 600; margin-inline-start: auto; }
.bk-calm-x { min-block-size: 44px; }

/* V25u: the day in words under a date box */
.datewords { display: block; margin-block-start: 4px; color: var(--text-muted, #475569); font-size: var(--text-sm, 14px); font-weight: 600; }
.datewords[hidden] { display: none; }
td .datewords, .inst-row .datewords { font-size: 12px; }

/* V25u: the Pay button on a collapsed "who owes" row */
.cl-act { margin-block-start: 8px; }
.cl-act .btn { min-block-size: 48px; padding-inline: 20px; }

/* V25u: staff attendance board: who has not checked in comes first */
.att-miss { margin-block: var(--space-3, 12px); padding: var(--space-3, 12px); border: 1px solid var(--amber-700, #b45309); border-radius: var(--radius-lg, 12px); background: var(--amber-50, #fffbeb); }
.att-miss-h { margin: 0 0 8px; font-size: var(--text-lg, 18px); }
.att-miss-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.att-miss-i { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-block-size: 56px; border-block-end: 1px solid var(--border); }
.att-miss-i:last-child { border-block-end: 0; }
.att-miss-n { display: flex; flex-direction: column; min-inline-size: 0; overflow-wrap: anywhere; }
.att-miss-i .btn { min-block-size: 44px; }

/* V25u: a net salary below zero is red, with the way out */
.is-neg, .pay-net--neg .pay-net-n { color: var(--red-700, #b91c1c) !important; }
.pay-negnote { display: flex; align-items: center; gap: 6px; color: var(--red-700, #b91c1c); font-weight: 600; font-size: var(--text-sm, 14px); margin: 4px 0 0; }
td .pay-negnote { display: block; }
.pay-negnote .i { inline-size: 16px; block-size: 16px; flex: none; }

/* V25u: file pick button in the page language (instead of the browser's "Choose File") */
.imp-pickrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.imp-pick { min-block-size: 48px; cursor: pointer; }
.imp-pick.is-focus { outline: 3px solid var(--blue-500, #3b82f6); outline-offset: 2px; }
.imp-fname { font-weight: 600; overflow-wrap: anywhere; min-inline-size: 0; }

/* V25u: Classroom tabs on a phone: one select (two groups) instead of a strip with 11 cut tabs */
.cls-tabsel-wrap { display: none; position: relative; margin-block-end: var(--space-3, 12px); }
.cls-tabsel-wrap .i { position: absolute; inset-inline-end: 14px; inset-block-start: 50%; transform: translateY(-50%); inline-size: 20px; block-size: 20px; pointer-events: none; }
.cls-tabsel { inline-size: 100%; min-block-size: 52px; font-weight: 700; padding-inline-end: 44px; }
@media (max-width: 600px) { .cls-tabsel-wrap { display: block; } #cls-tabs { display: none !important; } }

/* V25u: the More menu in a page head opens towards the inside of the page (it sat at the far side and ran off the screen) */
@media (min-width: 600px) { .view-actions .more-list, .view-headwrap .more-list { inset-inline-start: auto; inset-inline-end: 0; } }
details.more:not([open]) > .more-list { display: none; }
.pay-net.pay-net--neg { background: var(--red-50, #fdecea); border-color: var(--red-700, #b91c1c); }

/* V25u: the printed monthly report keeps the call links inside their (fixed width) cell: the number goes under the word Father / Mother when it does not fit */
@media print {
  .sa-sheet .sa-calls { flex-direction: column; gap: 2px; min-inline-size: 0; }
  .sa-sheet .sa-call { flex-wrap: wrap; gap: 0 4px; max-inline-size: 100%; min-inline-size: 0; justify-content: flex-start; }
}

/* v25.2: phone list rows (Students, Fees...): a long name must not run over the amount on the other side.
   ".dt a" and ".dt .dt-name" are inline-flex (44 px targets), which sized them to the whole name; inside the
   collapsed row they become block boxes that fit the column, and the name wraps to at most two lines. */
@media (max-width: 600px) {
  .dt-wrap--clist .dt tr.cl-row td.cl-main a.stu-who { display: flex; inline-size: 100%; max-inline-size: 100%; min-inline-size: 0; }
  .dt-wrap--clist .dt tr.cl-row td.cl-main .stu-who-t { flex: 1 1 auto; min-inline-size: 0; overflow: hidden; }
  .dt-wrap--clist .dt tr.cl-row td.cl-main .dt-name {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
    min-block-size: 0; max-inline-size: 100%; overflow: hidden; white-space: normal; overflow-wrap: anywhere; line-height: 1.3;
  }
  .dt-wrap--clist .dt tr.cl-row td.cl-main .dt-sub { max-inline-size: 100%; }
  .dt-wrap--clist .dt tr.cl-row td.cl-key { max-inline-size: 46vw; }
  .dt-wrap--clist .dt tr.cl-row .cl-keyval { overflow-wrap: anywhere; }
}

/* v25.3: Classroom > Teachers > Add: a class with no subjects shows a note and a box to add one here */
.as-nosub { margin-block: -4px 12px; padding: 10px 12px; border-radius: var(--radius-md, 10px); background: var(--blue-25, #f3f6fc); border: 1px solid var(--border, #d7deea); }
.as-nosub .hint { margin: 0 0 8px; color: var(--text); }
.as-nosub-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.as-nosub-row .control { flex: 1 1 160px; min-inline-size: 0; min-block-size: 44px; }
.as-nosub-row .btn { flex: none; min-block-size: 44px; }
.as-cp { margin-block-start: 12px; padding-block-start: 10px; border-block-start: 1px dashed var(--border, #d7deea); }
.as-cp .select-wrap { flex: 1 1 180px; min-inline-size: 0; }
.su-noclass { margin-inline-start: 6px; background: #fff4e5; color: #8a4b00; }
