/* SININBE EDU 3.9.0 — unified modern controls without excessive rounding */
#app{--se-control-radius:10px;--se-control-height:40px;--se-control-border:rgba(148,163,184,.22);--se-control-bg:rgba(255,255,255,.045);--se-control-hover:rgba(45,212,191,.10)}
#app button,#app .btn,#app input,#app select,#app textarea{font-family:"Tajawal","Space Grotesk",sans-serif;box-sizing:border-box}
#app button{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
#app button:not(.se-wb-swatch):not(.emoji-btn):not(.emj-item){transition:transform .15s ease,border-color .15s ease,background-color .15s ease,color .15s ease,box-shadow .15s ease}
#app button:not(:disabled):not(.se-wb-swatch):hover{transform:translateY(-1px)}
#app button:focus-visible,#app a:focus-visible,#app input:focus-visible,#app select:focus-visible,#app textarea:focus-visible{outline:0!important;box-shadow:0 0 0 3px rgba(45,212,191,.16)!important;border-color:rgba(45,212,191,.58)!important}
#app .btn,#app .se-pill,#app .se-attach-btn,#app .se-mini-actions button,#app .se-audit-option,#app .se-audit-msg-actions button,#app .tp-item,#app .se-admin-tabs button{border-radius:var(--se-control-radius)!important}
#app .btn{min-height:var(--se-control-height);display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:8px 13px;border:1px solid var(--se-control-border);font-weight:900;line-height:1.2}
#app .btn-ac{background:linear-gradient(135deg,#0f766e,#0d9488)!important;border-color:rgba(45,212,191,.54)!important;color:#fff!important;box-shadow:0 8px 24px rgba(13,148,136,.17)}
#app .btn-ac:hover{background:linear-gradient(135deg,#0d9488,#14b8a6)!important;box-shadow:0 10px 28px rgba(13,148,136,.24)}
#app .btn-ghost{background:var(--se-control-bg)!important;border-color:var(--se-control-border)!important;color:var(--text-secondary)!important}
#app .btn-ghost:hover{background:var(--se-control-hover)!important;border-color:rgba(45,212,191,.38)!important;color:var(--text-primary)!important}
#app .btn.danger,#app button.danger{border-color:rgba(251,113,133,.28)!important;color:#fda4af!important;background:rgba(244,63,94,.07)!important}
#app .btn.danger:hover,#app button.danger:hover{border-color:rgba(251,113,133,.48)!important;background:rgba(244,63,94,.13)!important;color:#fecdd3!important}
#app .se-admin-tabs{display:flex;align-items:center;gap:7px;padding:7px;border:1px solid rgba(148,163,184,.14);border-radius:13px;background:rgba(255,255,255,.018);overflow-x:auto;scrollbar-width:thin}
#app .se-admin-tabs button{min-height:39px;padding:8px 12px;border:1px solid transparent!important;background:transparent!important;color:var(--text-muted)!important;white-space:nowrap;font-weight:900}
#app .se-admin-tabs button:hover{background:rgba(45,212,191,.07)!important;color:var(--text-primary)!important}
#app .se-admin-tabs button.active{background:linear-gradient(135deg,rgba(13,148,136,.18),rgba(45,212,191,.08))!important;border-color:rgba(45,212,191,.32)!important;color:#5eead4!important;box-shadow:inset 0 0 0 1px rgba(45,212,191,.04)}
#app .se-mini-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}#app .se-mini-actions button{min-height:34px;padding:6px 10px;border:1px solid var(--se-control-border);background:var(--se-control-bg);color:var(--text-secondary);font-size:.62rem;font-weight:900}
#app .se-audit-option{border:1px solid var(--se-control-border)!important;background:rgba(255,255,255,.025)!important}.se-audit-option:hover{background:rgba(45,212,191,.075)!important}
#app .m-close,#app .se-audit-modal-close{width:40px!important;height:40px!important;min-width:40px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;padding:0!important;border:1px solid rgba(148,163,184,.26)!important;border-radius:10px!important;background:rgba(255,255,255,.045)!important;color:var(--text-secondary)!important;inset-block-start:12px!important;inset-inline-end:12px!important;box-sizing:border-box!important}
#app .m-close:hover,#app .se-audit-modal-close:hover{border-color:rgba(251,113,133,.45)!important;background:rgba(251,113,133,.11)!important;color:#fecdd3!important}
/* AI provider card */
#app .se-custom-ai-card{grid-column:1/-1;position:relative;overflow:hidden;background:linear-gradient(145deg,rgba(124,58,237,.055),rgba(14,116,144,.045))}
#app .se-custom-ai-card:before{content:"";position:absolute;inset-block-start:-70px;inset-inline-end:-70px;width:190px;height:190px;border-radius:50%;background:radial-gradient(circle,rgba(124,58,237,.13),transparent 68%);pointer-events:none}
#app .se-custom-ai-card .se-custom-card-head{display:grid;grid-template-columns:40px minmax(0,1fr) auto;align-items:start}
#app .se-ai-ready-badge{display:inline-flex;align-items:center;justify-content:center;min-height:28px;padding:5px 9px;border:1px solid rgba(148,163,184,.22);border-radius:8px;color:var(--text-muted);background:rgba(255,255,255,.035);font-size:.56rem;font-weight:950;white-space:nowrap}.se-ai-ready-badge.ready{color:#6ee7b7!important;border-color:rgba(52,211,153,.34)!important;background:rgba(16,185,129,.10)!important}.se-ai-ready-badge.local{color:#93c5fd!important;border-color:rgba(96,165,250,.30)!important;background:rgba(59,130,246,.08)!important}
#app .se-ai-fields{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(180px,.65fr);gap:12px}#app .se-ai-key-field{grid-column:1/-1}#app .se-input-action-row{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:7px;align-items:stretch}#app .se-field-icon-btn{width:44px;height:46px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--border-strong);border-radius:10px;background:rgba(255,255,255,.045);color:#7dd3fc;cursor:pointer}#app .se-field-icon-btn:hover{border-color:rgba(56,189,248,.48);background:rgba(56,189,248,.11)}
#app .se-ai-key-status{display:block;margin-top:6px;color:var(--text-muted);font-size:.56rem;font-weight:800}#app .se-ai-key-status.ok{color:#6ee7b7}#app .se-ai-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:13px}
#app[data-theme="light"]{--se-control-border:#d7e0ea;--se-control-bg:#fff;--se-control-hover:#ecfdf5}#app[data-theme="light"] .se-custom-ai-card{background:linear-gradient(145deg,#faf5ff,#f0fdfa)}
@media(max-width:760px){#app{--se-control-height:42px}#app .se-admin-tabs{border-radius:11px;padding:5px}#app .se-admin-tabs button{min-height:38px;padding:7px 10px}#app .se-ai-fields{grid-template-columns:1fr}#app .se-ai-key-field{grid-column:auto}#app .se-custom-ai-card .se-custom-card-head{grid-template-columns:38px minmax(0,1fr)}#app .se-ai-ready-badge{grid-column:1/-1;justify-self:start}#app .se-ai-actions .btn{flex:1 1 100%}#app .m-close,#app .se-audit-modal-close{inset-block-start:9px!important;inset-inline-end:9px!important;width:38px!important;height:38px!important;min-width:38px!important}}

/* SININBE EDU 3.9.2 — cross-device dialog geometry and attachment viewer stacking */
#app .modal.show{
  overflow:hidden!important;
  padding:max(4px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left))!important;
}
#app .modal.show>.m-box{
  min-width:0!important;
  min-height:0!important;
  max-width:calc(100dvw - 8px)!important;
  max-height:calc(100dvh - 8px)!important;
  box-sizing:border-box!important;
}
#app .m-box>*{min-width:0}
#app button,#app .btn,#app input,#app select,#app textarea{max-width:100%}
#app .se-admin-head,#app .se-contact-head,#app .tr69-admin-detail-toolbar,#app .edu-lsv-head{
  min-width:0!important;
}
#app .se-admin-head>*,#app .se-contact-head>*,#app .tr69-admin-detail-toolbar>*,#app .edu-lsv-head>*{min-width:0}
#app .se-search-row{min-width:0!important;max-width:100%!important}
#app .se-search-row input{min-width:0!important;width:100%!important}
#app .se-audit-msg [data-file-url],#app .se-audit-msg [data-code-url]{pointer-events:auto!important;touch-action:manipulation!important;cursor:pointer!important}
#app #m-lesson-viewer.edu-lsv-modal{z-index:2147483600!important}
#app #m-img,#app #m-video,#app #m-doc,#app #m-pdf,#app #m-pptx,#app #m-xls,#app #m-code{z-index:2147483600!important}
#app #ap-audit-modal.se-audit-modal-shell{overscroll-behavior:none!important}
#app #ap-audit-modal .se-audit-modal-card{min-width:0!important;min-height:0!important}
#app #ap-audit-modal #ap-audit-conversation{
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y!important;
  overscroll-behavior:contain!important;
  scroll-padding-block:18px max(24px,calc(env(safe-area-inset-bottom) + 16px))!important;
}
#app #ap-audit-modal #ap-audit-composer{
  min-width:0!important;
  position:relative!important;
  z-index:4!important;
  background:var(--surface2,var(--surface,#ffffff))!important;
  color:var(--text-primary,#172033)!important;
  border:1px solid var(--border,#d7e1ec)!important;
  border-radius:14px!important;
  padding:9px!important;
  background-image:none!important;
}
#app #ap-audit-modal #ap-audit-message{min-width:0!important;max-width:100%!important}
@media(max-width:760px){
 #app .se-admin-modal .m-box,#app .se-contact-modal .m-box{width:calc(100dvw - 8px)!important;height:calc(100dvh - 8px)!important;max-width:calc(100dvw - 8px)!important;max-height:calc(100dvh - 8px)!important;border-radius:12px!important;padding:8px!important}
 #app #ap-audit-modal.se-audit-modal-shell{inset:4px!important}
 #app #ap-audit-modal .se-audit-modal-card{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;border-radius:11px!important;padding:7px!important;gap:6px!important}
 #app #ap-audit-modal #ap-audit-tools{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:6px!important}
 #app #ap-audit-modal #ap-audit-tools .se-search-row{grid-column:1/-1!important;width:100%!important;min-width:0!important}
 #app #ap-audit-modal #ap-audit-summary{grid-column:1!important;width:42px!important;min-width:42px!important}
 #app #ap-audit-modal #ap-audit-delete-all{grid-column:2!important;width:auto!important;min-width:0!important;max-width:100%!important;padding-inline:10px!important}
 #app #ap-audit-modal #ap-audit-conversation{min-height:0!important;padding:8px!important}
 #app #ap-audit-modal #ap-audit-composer.on{display:grid!important;grid-template-columns:44px 44px minmax(0,1fr)!important;gap:6px!important;padding-top:6px!important;border-top:1px solid var(--border)!important}
 #app #ap-audit-modal #ap-audit-composer .btn{grid-column:1/-1!important;width:100%!important;min-height:42px!important}
 #app #ap-audit-modal #ap-audit-message{grid-column:3!important;min-height:72px!important;max-height:112px!important}
 #app .se-admin-tabs{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;overflow:visible!important;gap:6px!important}
 #app .se-admin-tabs button{width:100%!important;min-width:0!important;white-space:normal!important;text-align:center!important;overflow-wrap:anywhere!important}
 #app .se-audit-msg{max-width:100%!important;width:100%!important;box-sizing:border-box!important}
 #app .se-audit-msg .f-card,#app .se-audit-msg .vp-card,#app .se-audit-msg .chat-img{max-width:100%!important;width:100%!important;box-sizing:border-box!important}
 #app .se-audit-msg .vp-card{aspect-ratio:auto!important;min-height:180px!important}
 #app .edu-lsv-modal.show{padding:0!important}
 #app .edu-lsv-box{width:100dvw!important;height:100dvh!important;max-width:100dvw!important;max-height:100dvh!important;border-radius:0!important}
}
@media(max-width:380px){
 #app .se-admin-tabs{grid-template-columns:1fr!important}
 #app #ap-audit-modal #ap-audit-delete-all span{font-size:.58rem!important}
}


/* 4.0.30 — high-specificity theme parity for the administrative audit composer.
   This block intentionally matches the selector that previously forced a dark strip. */
html[data-theme="light"] #app #ap-audit-modal #ap-audit-composer,
body[data-theme="light"] #app #ap-audit-modal #ap-audit-composer,
#app[data-theme="light"] #ap-audit-modal #ap-audit-composer,
#m-adminpanel[data-theme="light"] #ap-audit-modal #ap-audit-composer{
  background:#f8fafc!important;
  background-image:none!important;
  color:#172033!important;
  border-color:#d7e1ec!important;
  box-shadow:none!important;
}
html[data-theme="light"] #app #ap-audit-modal #ap-audit-message,
body[data-theme="light"] #app #ap-audit-modal #ap-audit-message,
#app[data-theme="light"] #ap-audit-modal #ap-audit-message,
#m-adminpanel[data-theme="light"] #ap-audit-modal #ap-audit-message{
  background:#ffffff!important;
  color:#172033!important;
  border-color:#cbd5e1!important;
  -webkit-text-fill-color:#172033!important;
  box-shadow:none!important;
}
html[data-theme="light"] #app #ap-audit-modal #ap-audit-message::placeholder,
body[data-theme="light"] #app #ap-audit-modal #ap-audit-message::placeholder,
#app[data-theme="light"] #ap-audit-modal #ap-audit-message::placeholder{color:#64748b!important;opacity:1!important}
html[data-theme="light"] #app #ap-audit-modal #ap-audit-composer .se-attach-btn,
body[data-theme="light"] #app #ap-audit-modal #ap-audit-composer .se-attach-btn,
#app[data-theme="light"] #ap-audit-modal #ap-audit-composer .se-attach-btn{
  background:#ffffff!important;color:#334155!important;border-color:#cbd5e1!important;
}
html[data-theme="light"] #app #ap-audit-modal #ap-audit-send,
body[data-theme="light"] #app #ap-audit-modal #ap-audit-send,
#app[data-theme="light"] #ap-audit-modal #ap-audit-send{background:var(--primary,#0f9f8f)!important;color:#ffffff!important}
html[data-theme="dark"] #app #ap-audit-modal #ap-audit-composer,
body[data-theme="dark"] #app #ap-audit-modal #ap-audit-composer,
#app[data-theme="dark"] #ap-audit-modal #ap-audit-composer{
  background:#071126!important;color:#eef6ff!important;border-color:rgba(148,163,184,.20)!important;
}

/* 4.0.30 — exact theme binding for the administrative composer itself. */
#ap-audit-modal[data-theme="light"] #ap-audit-composer,
#ap-audit-composer[data-theme="light"]{
  background:#f8fafc!important;
  background-image:none!important;
  color:#172033!important;
  border-color:#d7e1ec!important;
  box-shadow:none!important;
}
#ap-audit-modal[data-theme="light"] #ap-audit-message,
#ap-audit-message[data-theme="light"]{
  background:#fff!important;
  color:#172033!important;
  -webkit-text-fill-color:#172033!important;
  border-color:#cbd5e1!important;
  caret-color:#0f766e!important;
}
#ap-audit-modal[data-theme="light"] #ap-audit-message::placeholder{color:#64748b!important;opacity:1!important}
#ap-audit-modal[data-theme="light"] #ap-audit-composer .se-attach-btn,
#ap-audit-composer[data-theme="light"] .se-attach-btn{
  background:#fff!important;color:#334155!important;border-color:#cbd5e1!important;
}
#ap-audit-modal[data-theme="dark"] #ap-audit-composer,
#ap-audit-composer[data-theme="dark"]{
  background:#071126!important;background-image:none!important;color:#eef6ff!important;border-color:rgba(148,163,184,.2)!important;
}
#ap-audit-modal[data-theme="dark"] #ap-audit-message,
#ap-audit-message[data-theme="dark"]{
  background:#0b1328!important;color:#fff!important;-webkit-text-fill-color:#fff!important;border-color:rgba(148,163,184,.28)!important;
}
