/* Aula/Biblio Control v1.1 — compact, task-first interface */
:root {
  --ui-bg: #f3f6f8;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f7f9fb;
  --ui-border: #dce4e9;
  --ui-muted: #66737d;
  --ui-ink: #18232d;
  --ui-shadow: 0 0.35rem 1.4rem rgba(24, 35, 45, 0.07);
  --ui-radius: 0.8rem;
  --control-radius: var(--ui-radius);
}

html { font-size: 15px; }
body { background: var(--ui-bg); color: var(--ui-ink); font-size: 1rem; line-height: 1.45; }
a, button, input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease; }

/* Stable compact header and a single, grouped navigation drawer. */
.control-header { min-height: 4.25rem; border-bottom: 1px solid var(--ui-border); box-shadow: 0 1px 8px rgba(20,35,45,.04); z-index: 1025; }
.control-header-inner { display: flex; align-items: center; gap: .8rem; min-height: 4.25rem; padding: .55rem clamp(.8rem, 2.5vw, 2rem); }
.menu-trigger { display: grid; place-items: center; flex: 0 0 2.7rem; width: 2.7rem; height: 2.7rem; border: 1px solid var(--ui-border); border-radius: .65rem; background: #fff; color: var(--control-secondary); font-size: 1.35rem; }
.menu-trigger:hover, .menu-trigger:focus-visible { border-color: var(--control-primary); background: color-mix(in srgb, var(--control-primary) 6%, #fff); }
.control-brand { display: flex; align-items: center; gap: .65rem; min-width: 0; margin: 0; padding: 0; text-decoration: none; }
.control-brand .brand-mark, .control-brand .brand-logo { flex: 0 0 2.45rem; width: 2.45rem; height: 2.45rem; }
.control-brand > span:last-child { min-width: 0; }
.control-brand strong, .control-brand small { display: block; overflow: hidden; max-width: min(33vw, 23rem); text-overflow: ellipsis; white-space: nowrap; }
.control-brand strong { color: var(--control-secondary); font-size: 1.05rem; line-height: 1.2; }
.control-brand small { color: var(--ui-muted); font-size: .73rem; }
.header-actions { display: flex; align-items: center; gap: .65rem; margin-left: auto; }
.header-primary-action { min-height: 2.45rem; padding: .62rem 1rem; border-radius: .65rem; background: var(--control-primary); color: #fff; font-size: .88rem; font-weight: 750; text-decoration: none; }
.header-primary-action:hover, .header-primary-action:focus { background: var(--control-secondary); color: #fff; }
.user-trigger { display: flex; align-items: center; gap: .5rem; max-width: 13rem; min-height: 2.45rem; padding: .3rem .65rem .3rem .35rem; border: 1px solid var(--ui-border); border-radius: 999px; background: #fff; }
.user-trigger > span { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--control-secondary); color: #fff; font-size: .76rem; font-weight: 800; text-transform: uppercase; }
.user-trigger small { overflow: hidden; color: var(--ui-ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.language-switch { margin-left: 0; }
.control-navigation { width: min(22rem, 92vw); border: 0; }
.control-navigation .offcanvas-header { align-items: flex-start; padding: 1.25rem 1.25rem .8rem; border-bottom: 1px solid var(--ui-border); }
.control-navigation .offcanvas-title { margin: .15rem 0 0; color: var(--control-secondary); font-size: 1.25rem; font-weight: 800; }
.control-navigation .offcanvas-body { display: flex; flex-direction: column; padding: .8rem; }
.control-nav { display: grid; gap: .18rem; }
.nav-group-title { margin: .7rem .65rem .25rem; color: #82909a; font-size: .68rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.control-nav a { display: flex; align-items: center; gap: .7rem; min-height: 2.65rem; padding: .45rem .65rem; border-radius: .65rem; color: #34424d; font-weight: 690; text-decoration: none; }
.control-nav a > span { display: grid; place-items: center; flex: 0 0 1.9rem; width: 1.9rem; height: 1.9rem; border-radius: .5rem; background: #edf2f5; color: var(--control-primary); font-size: .78rem; font-weight: 850; }
.control-nav a:hover { background: #f1f5f7; color: var(--control-secondary); }
.control-nav a.active { background: color-mix(in srgb, var(--control-primary) 11%, #fff); color: var(--control-primary); }
.control-nav a.active > span { background: var(--control-primary); color: #fff; }
.control-nav a.provider-nav > span { background: color-mix(in srgb, var(--control-accent) 30%, #fff); color: #69500d; }
.nav-account { display: grid; gap: .15rem; margin-top: auto; padding: 1rem .65rem .2rem; border-top: 1px solid var(--ui-border); }
.nav-account small { overflow: hidden; color: var(--ui-muted); text-overflow: ellipsis; }
.nav-account form { margin-top: .65rem; }

/* Typography and density shared by every management screen. */
.control-main { width: 100%; min-height: calc(100vh - 8.5rem); padding: 1.7rem clamp(.85rem, 2.5vw, 2rem) 2rem; }
.page-heading { margin-bottom: 1.25rem !important; }
.page-heading h1, .activation-heading h1 { margin: .12rem 0 .28rem; font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 830; letter-spacing: -.035em; }
.page-heading p, .activation-heading p { max-width: 55rem; margin: 0; color: var(--ui-muted); font-size: .96rem; }
.eyebrow { font-size: .68rem; letter-spacing: .1em; }
.section-title { margin-bottom: .75rem; font-size: .95rem; }
.panel { padding: clamp(1rem, 2vw, 1.35rem); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); }
.panel.mb-4, .capacity-card.mb-4 { margin-bottom: 1rem !important; }
.panel > .d-flex:first-child > .btn { align-self: flex-start; }
.panel .mb-5 { margin-bottom: 1.5rem !important; }
.row.g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
.form-label { margin-bottom: .33rem; color: #33414c; font-size: .84rem; font-weight: 730; }
.form-text { margin-top: .3rem; color: var(--ui-muted); font-size: .75rem; }
.form-control, .form-select, .form-control-lg, .form-select-lg { min-width: 0; min-height: 2.55rem; padding: .5rem .7rem; border-color: #cfd9df; border-radius: .55rem; font-size: .94rem; line-height: 1.35; }
.form-select, .form-select-lg { overflow: hidden; padding-right: 2.25rem; text-overflow: ellipsis; white-space: nowrap; }
textarea.form-control { min-height: 5.5rem; }
.btn, .btn-lg { min-height: 2.45rem; padding: .48rem .85rem; border-radius: .55rem; font-size: .9rem; font-weight: 700; line-height: 1.3; }
.btn-sm { min-height: 2rem; padding: .32rem .58rem; font-size: .78rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.sticky-actions { position: sticky; z-index: 10; bottom: .8rem; justify-content: flex-end; width: fit-content; margin: 1rem 0 0 auto; padding: .5rem; border: 1px solid var(--ui-border); border-radius: .75rem; background: rgba(255,255,255,.94); box-shadow: 0 .5rem 2rem rgba(24,35,45,.14); backdrop-filter: blur(8px); }
.alert { padding: .75rem 1rem; border-radius: .65rem; }
.empty-state { padding: 2rem 1rem; }

/* Tables remain dense on desktop and become labelled cards on small screens. */
.table-panel { padding: 0; overflow: hidden; }
.control-table { margin: 0; }
.control-table th { padding: .65rem .8rem; font-size: .67rem; letter-spacing: .055em; }
.control-table td { padding: .63rem .8rem; font-size: .88rem; }
.table-note { font-size: .72rem; }
.filter-bar { padding: .85rem 1rem; }
.recent-heading { padding: 1rem 1.1rem; }
.recent-heading h2 { font-size: 1.05rem; }
.pagination-wrap { margin-top: .9rem; }
.state-badge, .type-badge, .status-pill { min-height: 1.75rem; padding: .25rem .55rem; font-size: .7rem; }
.management-list { gap: .45rem; }
.management-list > a, .management-row > a { min-width: 0; padding: .65rem .75rem; border-radius: .65rem; }
.management-row { min-width: 0; }
.management-row > a { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--ui-border); border-radius: .65rem; color: inherit; text-decoration: none; }
.management-row > a:hover, .management-row > a:focus { border-color: var(--control-primary); background: color-mix(in srgb, var(--control-primary) 4%, #fff); }
.management-row > a > span:not(.app-list-icon) { flex: 1; min-width: 0; }
.management-row > a strong, .management-row > a small { display: block; }
.management-row > a small { overflow: hidden; color: var(--ui-muted); text-overflow: ellipsis; white-space: nowrap; }
.management-row > a b { color: var(--control-primary); font-size: 1.25rem; }
.app-list-icon { width: 2.2rem; height: 2.2rem; }
.app-list-icon img { width: 1.8rem; height: 1.8rem; object-fit: contain; }
.app-choice-icon img { width: 2rem; height: 2rem; object-fit: contain; }
.app-icon-preview { display: flex; align-items: center; gap: .8rem; }
.app-icon-preview img { width: 3.5rem; height: 3.5rem; object-fit: contain; }

/* The daily grant task is dominant, but not oversized. */
.activation-heading { gap: 1rem; margin-bottom: 1rem !important; }
.server-day { min-width: 11rem; padding: .65rem .85rem; border-radius: .7rem; }
.server-day strong { font-size: 1.05rem; }
.activation-desk { border-top-width: .3rem; }
.activation-label { margin-bottom: .4rem; }
.activation-entry { grid-template-columns: minmax(13rem, 1fr) 7rem auto; gap: .55rem; }
.activation-input, .minutes-control .form-control, .activation-submit { height: 3.2rem; min-height: 3.2rem; }
.activation-input { font-size: 1.2rem; }
.activation-submit { padding-inline: 1.2rem; font-size: .95rem; }
.activation-help { margin: .45rem 0 0; font-size: .8rem; }
.activation-result { gap: .9rem; margin-top: 1rem; padding: .85rem 1rem; border-radius: .7rem; }
.activation-result-icon { flex-basis: 2.65rem; height: 2.65rem; font-size: 1.25rem; }
.activation-result h2 { font-size: 1.15rem; }
.activation-result > div { flex: 1; min-width: 0; }
.activation-edit { align-self: flex-start; margin-left: auto; }
.activation-user-details { grid-template-columns: repeat(4, minmax(0,1fr)); margin-top: .55rem; }
.reset-grant-card, .quick-create-card { padding: .75rem .9rem; border-radius: .7rem; }

/* Long configuration pages disclose one coherent section at a time. */
.settings-form, form[action$="/admin/system"] { display: grid; gap: .7rem; }
.settings-section { padding: 0; overflow: clip; }
.settings-section > summary { display: flex; align-items: center; min-height: 4rem; padding: .8rem 1rem; cursor: pointer; list-style: none; }
.settings-section > summary::-webkit-details-marker { display: none; }
.settings-section > summary::after { content: '+'; margin-left: auto; color: var(--control-primary); font-size: 1.45rem; font-weight: 500; }
.settings-section[open] > summary::after { content: '−'; }
.settings-section > summary span, .settings-section > summary strong, .settings-section > summary small { display: block; }
.settings-section > summary strong { font-size: 1rem; }
.settings-section > summary small { margin-top: .1rem; color: var(--ui-muted); font-size: .78rem; font-weight: 450; }
.settings-section[open] > summary { border-bottom: 1px solid var(--ui-border); background: var(--ui-surface-soft); }
.settings-content { padding: 1rem; }
.kiosk-policy { height: 100%; padding: .8rem; border-radius: .65rem; }
.kiosk-policy p { font-size: .82rem; }
.compact-checks { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .45rem .9rem; }
.color-control { padding: .35rem; }
.color-control input { width: 2.3rem; height: 2.3rem; }
.jodit-container:not(.jodit_inline) { border-color: #cfd9df !important; border-radius: .55rem !important; }
.jodit-toolbar__box { border-radius: .55rem .55rem 0 0 !important; }
.jodit-workplace { font-family: Inter, ui-sans-serif, system-ui, sans-serif !important; }

/* Device and summary cards show more useful information before scrolling. */
.capacity-card { padding: .8rem 1rem; border-radius: .7rem; }
.commercial-summary, .diagnostic-grid { gap: .65rem; }
.metric-card { padding: .85rem 1rem; border-radius: .7rem; }
.metric-card strong { margin-top: .15rem; font-size: 1.55rem; }
.feature-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .6rem; }
.feature-item, .feature-toggle { padding: .75rem; border-radius: .65rem; }
.stat-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.2rem; padding: .75rem 1rem; border: 1px solid var(--ui-border); border-radius: .7rem; background: #fff; box-shadow: var(--ui-shadow); }
.stat-card span { color: var(--ui-muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; }
.stat-card strong { color: var(--control-secondary); font-size: 1.35rem; }
.commercial-summary article, .diagnostic-item { padding: .75rem .9rem; border-radius: .65rem; }
.operation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.operation-wide { grid-column: 1 / -1; }
.device-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 29rem), 1fr)); gap: .7rem; }
.device-card { gap: .65rem; padding: .85rem; border-radius: .7rem; }
.device-card > .d-flex:first-child { align-items: flex-start; }
.device-card > .d-flex:first-child .badge { align-self: flex-start; }
.device-meta { grid-template-columns: repeat(4, minmax(0,1fr)); gap: .45rem .7rem; }
.device-settings { margin-top: .25rem; padding-top: .55rem; }
.pairing-code-panel { padding: .8rem 1rem; }
.pairing-code { font-size: 1.6rem; }

/* Client authentication is calm and compact. */
.client-body { padding: 1rem; }
.client-shell { width: 100%; padding-block: 2rem; }
.client-card { width: min(100%, 58rem); padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: 1rem; }
.client-brand h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.client-brand p { font-size: 1rem; }
.access-card { min-height: 8rem; padding: 1rem; border-radius: .75rem; }
.client-login-card { width: min(100%, 36rem); }
.client-login-card .client-brand h1 { font-size: 1.8rem; }
.terms-box { max-height: 15rem; overflow: auto; padding: .8rem; border: 1px solid var(--ui-border); border-radius: .65rem; background: #f8fafb; font-size: .85rem; text-align: left; }
.terms-box > :last-child { margin-bottom: 0; }

/* Windows-like desktop: icons launch only through the native control protocol. */
.has-client-session { min-height: 100vh; overflow: hidden; padding: 0; background: #174c70 radial-gradient(circle at 72% 18%, #397eaa 0, #1d628e 28%, #164b70 64%, #123d5d 100%); }
.has-client-session .client-language { display: none; }
.has-client-session .client-shell { width: 100%; max-width: none; height: 100vh; padding: 0; }
.has-client-session .client-alert { position: fixed; z-index: 40; top: 4.8rem; left: 50%; width: min(38rem, calc(100% - 2rem)); transform: translateX(-50%); }
.windows-shell { display: grid; grid-template-rows: auto 1fr auto; width: 100%; height: 100vh; color: #fff; }
.desktop-bar { display: flex; align-items: center; gap: 1rem; min-height: 4.25rem; padding: .55rem 1rem; background: rgba(9, 35, 53, .9); box-shadow: 0 2px 14px rgba(0,0,0,.18); backdrop-filter: blur(12px); }
.desktop-brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.desktop-brand img, .desktop-brand .brand-mark { width: 2.65rem; height: 2.65rem; object-fit: contain; }
.desktop-brand strong, .desktop-brand small { display: block; overflow: hidden; max-width: 25vw; text-overflow: ellipsis; white-space: nowrap; }
.desktop-brand small { color: rgba(255,255,255,.7); font-size: .72rem; }
.desktop-session { display: flex; align-items: center; gap: .8rem; margin-left: auto; }
.desktop-session > span { display: grid; min-width: 6rem; }
.desktop-session small { color: rgba(255,255,255,.68); font-size: .66rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.desktop-session strong { overflow: hidden; max-width: 14rem; text-overflow: ellipsis; white-space: nowrap; }
.desktop-exit { min-height: 2.4rem; padding: .45rem .8rem; border: 1px solid rgba(255,255,255,.35); border-radius: .55rem; background: rgba(255,255,255,.1); color: #fff; font-weight: 700; }
.desktop-exit:hover { background: #fff; color: #163e5c; }
.windows-desktop { position: relative; min-height: 0; overflow: auto; padding: 1rem; }
.desktop-instruction { position: absolute; top: .75rem; right: 1rem; margin: 0; color: rgba(255,255,255,.7); font-size: .74rem; }
.client-app-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 7.2rem); grid-auto-columns: 7.5rem; justify-content: start; align-content: start; gap: .45rem .2rem; height: 100%; margin: 0; padding-top: .35rem; }
.client-app { display: grid; grid-template-rows: 4.4rem auto; place-items: center; width: 7.2rem; min-height: 7rem; padding: .25rem; border: 1px solid transparent; border-radius: .3rem; background: transparent; color: #fff; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.client-app:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.13); transform: none; color: #fff; }
.client-app:focus { border-color: rgba(255,255,255,.7); outline: 2px solid rgba(255,255,255,.45); outline-offset: -2px; background: rgba(47, 139, 196, .5); color: #fff; }
.client-app-icon { display: grid; place-items: center; width: 4rem; height: 4rem; filter: drop-shadow(0 .18rem .18rem rgba(0,0,0,.35)); }
.client-app-icon img { width: 100%; height: 100%; object-fit: contain; }
.client-app-icon b { font-size: 2.8rem; line-height: 1; }
.client-app strong { display: -webkit-box; overflow: hidden; margin: 0; font-size: .78rem; font-weight: 650; line-height: 1.15; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.desktop-empty { margin: auto; padding: 1rem 1.2rem; border-radius: .75rem; background: rgba(7,31,48,.55); color: rgba(255,255,255,.85); }
.desktop-taskbar { display: flex; gap: 1rem; min-height: 2.25rem; padding: .48rem 1rem; background: rgba(10,31,45,.86); color: rgba(255,255,255,.72); font-size: .73rem; backdrop-filter: blur(10px); }
.has-client-session .native-controls { position: fixed; z-index: 20; right: .75rem; bottom: .28rem; gap: .35rem; margin: 0; }
.has-client-session .native-controls .btn { min-height: 1.7rem; padding: .2rem .5rem; border-color: rgba(255,255,255,.25); background: rgba(9,35,53,.7); color: #fff; font-size: .68rem; }
.has-client-session .session-warning { position: fixed; z-index: 30; top: 4.8rem; left: 50%; width: min(34rem, calc(100% - 2rem)); margin: 0; transform: translateX(-50%); }

.control-footer { margin-top: 0; }
.control-footer .container-xxl { display: flex; justify-content: space-between; gap: 1rem; padding-top: .9rem; padding-bottom: .9rem; font-size: .8rem; }

@media (max-width: 767.98px) {
  html { font-size: 14px; }
  .control-header-inner { min-height: 3.8rem; }
  .control-brand strong { max-width: 38vw; }
  .control-brand small, .user-trigger small, .header-primary-action, .language-switch { display: none; }
  .control-main { padding-top: 1.15rem; }
  .page-heading h1, .activation-heading h1 { font-size: 1.65rem; }
  .activation-heading { align-items: stretch; }
  .server-day { min-width: 0; text-align: left; }
  .activation-entry { grid-template-columns: 1fr 6.5rem; }
  .activation-submit { grid-column: 1 / -1; width: 100%; }
  .activation-user-details { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .compact-checks { grid-template-columns: 1fr; }
  .device-meta { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .control-footer .container-xxl { flex-direction: column; }
  .desktop-bar { align-items: flex-start; min-height: 4rem; padding: .45rem .6rem; }
  .desktop-brand small, .desktop-session > span:first-child { display: none; }
  .desktop-session { gap: .45rem; }
  .desktop-session > span { min-width: 4.5rem; }
  .desktop-exit { padding-inline: .55rem; font-size: .72rem; }
  .windows-desktop { padding: .65rem; }
  .client-app-grid { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, 6.5rem); grid-template-rows: none; grid-auto-columns: auto; height: auto; }
  .client-app { width: 6.2rem; }
  .desktop-instruction { display: none; }
}

@media (min-width: 768px) {
  .diagnostic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row.g-4 > .col-xl-6 { width: 50%; }
  .row.g-4 > .col-lg-5 { width: 41.66666667%; }
  .row.g-4 > .col-lg-7 { width: 58.33333333%; }
  .filter-bar .row > .col-lg-3 { width: 25%; }
  .filter-bar .row > .col-lg-2 { width: 16.66666667%; }
}

@media (max-width: 575.98px) {
  .operation-grid { grid-template-columns: 1fr; }
  .operation-wide { grid-column: auto; }
  .panel { padding: .85rem; }
  .settings-section { padding: 0; }
  .settings-content { padding: .8rem; }
  .sticky-actions { right: 0; bottom: .45rem; width: 100%; }
  .sticky-actions .btn { width: 100%; }
  .activation-entry { grid-template-columns: 1fr 5.8rem; }
  .activation-input { font-size: 1.05rem; }
  .activation-user-details { grid-template-columns: 1fr; }
  .client-body:not(.has-client-session) { padding: .5rem; }
  .client-shell { padding-block: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
