/* ============================================================
   Muscle Manage — Laravel app additions on top of the prototype design system
   ============================================================ */

/* Attendance status radio pills */
.att-group { display: inline-flex; gap: 4px; }
.att-group input { position: absolute; opacity: 0; pointer-events: none; }
.att-group label {
  min-width: 34px; height: 32px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--text-3); transition: var(--trans); user-select: none;
}
.att-group input:focus-visible + label { outline: 2px solid var(--brand-blue); outline-offset: 1px; }
.att-group input[value="present"]:checked + label { background: #dcfce7; color: #16a34a; border-color: #86efac; }
.att-group input[value="absent"]:checked + label  { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.att-group input[value="late"]:checked + label    { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.att-group input[value="leave"]:checked + label   { background: #e6effe; color: #1d4ed8; border-color: #93c5fd; }

/* Day-of-week checkbox chips */
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chips input { position: absolute; opacity: 0; pointer-events: none; }
.day-chips label {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; background: var(--surface); color: var(--text-2); user-select: none;
}
.day-chips input:checked + label { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.day-chips input:focus-visible + label { outline: 2px solid var(--brand-blue); outline-offset: 1px; }

/* Laravel pagination inside our table cards */
.table-card .pagination { margin: 0; }
.pagination .page-link { color: var(--text-2); background: var(--surface); border-color: var(--border); }
.pagination .page-item.active .page-link { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.pagination .page-item.disabled .page-link { background: var(--surface-2, var(--surface)); color: var(--text-3); }

.invalid-feedback { font-size: 12px; }
.form-card { max-width: 980px; }
.link-plain { color: inherit; text-decoration: none; }
.link-plain:hover { color: var(--brand-blue); }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.auth-side { background: linear-gradient(145deg, var(--brand-navy), #1e3a8a); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-family: 'Sora', sans-serif; font-size: 34px; line-height: 1.2; margin: 0 0 12px; }
.auth-side p { color: rgba(255,255,255,.75); max-width: 420px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-form .card { width: 100%; max-width: 440px; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .page-head__actions { display: none !important; }
  .main { margin: 0 !important; }
}

/* Settings */
.settings-side { flex: 0 0 236px; align-self: flex-start; position: sticky; top: 84px; }
.set-nav { display: flex; flex-direction: column; gap: 2px; }
.set-nav a, .set-nav span { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.set-nav a:hover { background: var(--surface-3); color: var(--text); }
.set-nav a.active { background: var(--brand-blue-soft); color: var(--brand-blue); font-weight: 600; }
.set-nav span.disabled { color: var(--text-3); opacity: .7; cursor: default; }
.set-nav__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); padding: 12px 12px 4px; font-weight: 600; }
@media (max-width: 900px) {
  .settings-wrap { flex-direction: column; }
  .settings-side { flex: none; position: static; width: 100%; }
  .set-nav { flex-direction: row; overflow-x: auto; }
  .set-nav a, .set-nav span { white-space: nowrap; }
  .set-nav__label, .set-nav span.disabled { display: none; }
}

/* Permission matrix */
.perm-table th, .perm-table td { text-align: center; vertical-align: middle; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-check { width: 20px; height: 20px; cursor: pointer; }
.perm-na { color: var(--text-3); }

.brand-swatch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.brand-swatch input[type=color] { width: 40px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.audit-changes { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.audit-changes code { font-size: 11px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }

/* Communication — inbox (adapted from the prototype's communication.html) */
.chat-wrap { display: grid; grid-template-columns: 310px 1fr 280px; height: calc(100vh - 64px - 150px); min-height: 520px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.chat-wrap.no-info { grid-template-columns: 310px 1fr; }
.conv-list { border-right: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
.conv { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; border-left: 3px solid transparent; }
.conv:hover { background: var(--surface-2); color: inherit; }
.conv.active { background: var(--surface-2); border-left-color: var(--brand-blue); }
.conv .preview { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .preview { color: var(--text); font-weight: 600; }
.unread-dot { background: #25d366; color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; }
.chat-main { display: flex; flex-direction: column; background: var(--app-bg, var(--bg)); min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 11px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; background-image: radial-gradient(var(--border) 0.5px, transparent 0.5px); background-size: 18px 18px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; box-shadow: var(--shadow-xs); white-space: pre-wrap; word-wrap: break-word; }
.msg.in { background: var(--surface); border-top-left-radius: 4px; align-self: flex-start; }
.msg.out { background: #dcf8c6; color: #0b3d13; border-top-right-radius: 4px; align-self: flex-end; }
:root[data-theme="dark"] .msg.out { background: #1f5c33; color: #e8f5e9; }
.msg.failed { background: #fee2e2; color: #7f1d1d; }
:root[data-theme="dark"] .msg.failed { background: #4c1d1d; color: #fecaca; }
.msg .meta { font-size: 10.5px; opacity: .65; display: flex; justify-content: flex-end; gap: 6px; margin-top: 3px; align-items: center; white-space: nowrap; }
.msg .subj { font-weight: 700; display: block; margin-bottom: 2px; }
.msg .err { font-size: 11.5px; display: block; margin-top: 3px; font-weight: 600; }
.msg-day { align-self: center; font-size: 11px; color: var(--text-3); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; margin: 6px 0; }
.tick-read { color: #34b7f1; }
.chat-compose { padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-compose textarea { flex: 1; border-radius: 18px; border: 1px solid var(--border); padding: 9px 16px; background: var(--surface-2); color: var(--text); resize: none; max-height: 140px; font-size: 13.5px; }
.chat-compose textarea:focus { outline: none; border-color: var(--brand-blue); box-shadow: var(--ring); }
.tpl-bar { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; }
.chat-info { border-left: 1px solid var(--border); overflow-y: auto; padding: 18px; }
.chan-ico { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; color: #fff; flex-shrink: 0; }
.sim-banner { font-size: 12px; padding: 6px 14px; background: var(--brand-gold-soft); color: var(--text-2); border-bottom: 1px solid var(--border); }
@media (max-width: 1200px) { .chat-wrap { grid-template-columns: 280px 1fr; } .chat-info { display: none; } }
@media (max-width: 768px) {
  .chat-wrap { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .chat-wrap.has-active .conv-list { display: none; }
  .chat-wrap:not(.has-active) .chat-main { display: none; }
  .chat-msgs { min-height: 50vh; }
  .msg { max-width: 88%; }
}

/* ---------- Inventory ---------- */
.tabbar > a {
  color: var(--text-2); font-weight: 600; font-size: 13.5px; padding: 12px 15px; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: var(--trans); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.tabbar > a:hover { color: var(--text); }
.tabbar > a.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }
.inv-stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.inv-swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.po-lines { display: flex; flex-direction: column; gap: 8px; }
.po-line { display: grid; grid-template-columns: minmax(0, 1fr) 90px 150px 90px 32px; gap: 8px; align-items: center; }
.po-line__amt { text-align: right; font-size: 13px; }
.po-doc { color: var(--text); }
.po-sheet { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.po-sheet td, .po-sheet th { vertical-align: middle; }
@media (max-width: 640px) {
  .po-line { grid-template-columns: 1fr 1fr 32px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .po-line select { grid-column: 1 / -1; }
  .po-line__amt { grid-column: 1 / 3; text-align: left; }
  .po-line [data-remove] { grid-row: 3; grid-column: 3; }
  .inv-charts { flex-direction: column; }
  .inv-charts > .card { width: 100%; }
}

/* ---------- Payroll run ---------- */
.pr-summary__grid { display: grid; grid-template-columns: 1.1fr 1.2fr 1fr; }
.pr-summary__cell { padding: 20px 22px; min-width: 0; }
.pr-summary__cell + .pr-summary__cell { border-left: 1px solid var(--border); }
.pr-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.pr-big { font-family: Sora, sans-serif; font-size: 30px; font-weight: 700; line-height: 1.1; margin-bottom: 14px; }
.pr-breakdown { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.pr-breakdown > div { display: flex; justify-content: space-between; gap: 12px; }
.pr-breakdown dt { font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.pr-breakdown dd { margin: 0; font-weight: 600; }
.pr-progress { height: 10px; border-radius: 99px; background: var(--surface-3); margin: 6px 0 16px; }
.pr-progress .progress-bar { background: var(--success); border-radius: 99px; }
.pr-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--surface-3); border: 1px solid var(--border); }
.pr-dot--paid { background: var(--success); border-color: var(--success); }
.pr-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pr-timeline li { display: flex; gap: 10px; align-items: flex-start; position: relative; font-size: 13px; color: var(--text-3); }
.pr-timeline li:not(:last-child)::after { content: ''; position: absolute; left: 12px; top: 28px; bottom: -10px; width: 2px; background: var(--border); }
.pr-timeline li.is-done:not(:last-child)::after { background: var(--success); }
.pr-timeline__ico { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 12px; background: var(--surface-3); color: var(--text-3); }
.pr-timeline li b { display: block; font-weight: 600; line-height: 1.3; }
.pr-timeline li small { display: block; font-size: 12px; }
.pr-timeline li.is-done, .pr-timeline li.is-current { color: var(--text); }
.pr-timeline li.is-done small, .pr-timeline li.is-current small { color: var(--text-2); }
.pr-timeline li.is-done .pr-timeline__ico { background: var(--success); color: #fff; }
.pr-timeline li.is-current .pr-timeline__ico { background: var(--brand-blue-soft); color: var(--brand-blue); box-shadow: 0 0 0 3px var(--brand-blue-soft); }
.pr-summary__foot { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13px; border-radius: 0 0 var(--radius) var(--radius); }
.pr-summary__foot .bi { color: var(--brand-blue); }
.pr-table td { vertical-align: middle; }
.pr-table td:first-child { min-width: 210px; }
.pr-table .cell-user b { white-space: nowrap; }
.pr-table th:last-child, .pr-table td:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(15,23,42,.18); }
.pr-table tfoot td:last-child { background: var(--surface-2); }
@media (max-width: 1199px) {
  .pr-table td:first-child { min-width: 0; }
  .pr-table th:last-child, .pr-table td:last-child { position: static; box-shadow: none; background: none; }
}
.pr-name { color: inherit; text-decoration: none; }
.pr-name:hover b { color: var(--brand-blue); text-decoration: underline; }
.pr-tag { font-size: 10.5px; padding: 1px 7px; margin-left: 4px; }
.pr-status { display: inline-flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.pr-plus { color: var(--success); }
.pr-minus { color: var(--danger); }
.pr-table tr[hidden] { display: none !important; }
.pr-form-group { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; padding-top: 4px; border-top: 1px solid var(--border); }
.pr-form-group:first-child { border-top: none; padding-top: 0; }
.pr-form-group .bi { margin-right: 4px; }
.pr-modal-foot { flex-wrap: wrap; gap: 8px; }
@media (max-width: 992px) {
  .pr-summary__grid { grid-template-columns: 1fr 1fr; }
  .pr-summary__cell:nth-child(3) { grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--border); }
  .pr-timeline { flex-direction: row; flex-wrap: wrap; gap: 12px 20px; }
  .pr-timeline li { flex: 1; min-width: 150px; }
  .pr-timeline li::after { display: none; }
}
@media (max-width: 640px) {
  .pr-summary__grid { grid-template-columns: 1fr; }
  .pr-summary__cell + .pr-summary__cell { border-left: none; border-top: 1px solid var(--border); }
  .pr-summary__cell { padding: 16px; }
  .pr-big { font-size: 26px; }
  .pr-timeline { flex-direction: column; }
  .pr-status { align-items: flex-end; }
  .pr-table .search-inline, .table-card .card-head .search-inline { width: 100%; }
}
@media print {
  .pr-summary__foot { background: none; }
}

/* Student profile photos (x-student-avatar, student-photo.js) */
.avatar--photo { overflow: hidden; background: var(--surface-3) !important; }
.avatar--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit { position: relative; display: inline-block; }
.avatar-edit__btn {
  position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface);
  background: var(--brand-blue); color: #fff; display: grid; place-items: center; font-size: 11px; padding: 0; cursor: pointer;
}
.avatar-edit__btn:hover { background: var(--brand-blue-600); }
.photo-row { display: flex; align-items: center; gap: 16px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.photo-row__body { flex: 1; min-width: 0; }
.photo-row__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.photo-link-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--brand-blue-soft); color: var(--brand-blue-700); font-size: 12.5px;
}
.photo-link-strip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.2); animation: photoPulse 1.6s infinite; }
.photo-link-strip .btn { padding: 2px 8px; font-size: 12px; }
@keyframes photoPulse { 50% { box-shadow: 0 0 0 6px rgba(22,163,74,0); } }
.photo-link__timer { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.photo-link__timer.warn { background: var(--warning-soft); color: #b45309; }
.photo-link__status { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; border: 1px dashed var(--border-strong); margin-top: 16px; font-size: 13.5px; }
.photo-link__status.ok { border: 1px solid #86efac; background: var(--success-soft); }
.photo-link__status.bad { border: 1px solid #fcd34d; background: var(--warning-soft); }
.photo-link-strip[hidden], .photo-link__timer[hidden] { display: none; } /* their display rules would otherwise override [hidden] */
