/* Mobile shell. Document previews retain their original print typography. */
:root { color-scheme: dark; --app-accent: #38bdf8; --app-bottom: calc(84px + env(safe-area-inset-bottom)); }
html, body { height: 100%; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
@media screen {
  body { background: #080f20; }
  #appRoot { height: 100dvh; overflow: hidden; background: radial-gradient(ellipse at 95% 0, #12304766, transparent 45%), #080f20; }
  #appRoot header { flex-shrink: 0; background: #0d172be8; border-color: #26374a; }
  #appRoot header > div { max-width: 720px; gap: 8px; }
  #appRoot main { min-height: 0; overscroll-behavior-y: contain; padding: 20px 16px var(--app-bottom); scroll-behavior: smooth; }
  #mainContainer { max-width: 680px; }
  #mainContainer section { scroll-margin-top: 16px; }
  #mainContainer input.flex-1 { min-width: 0; }
  #mainContainer .text-xs { font-size: .875rem; line-height: 1.45; }
  #mainContainer .text-\[9px\], #mainContainer .text-\[10px\], #mainContainer .text-\[11px\] { font-size: .75rem; line-height: 1.4; }
  #mainContainer h2 { letter-spacing: -.025em; }
  #mainContainer h3 { line-height: 1.5; }
  #mainContainer .bg-slate-900 { background-color: #111e32; }
  #mainContainer .border-slate-800, #mainContainer .border-slate-800\/80 { border-color: #293950; }
  #mainContainer .text-slate-500 { color: #99a9bf; }
  #viewHome > div:first-child { background: radial-gradient(ellipse at top right, #12658966, transparent 75%), linear-gradient(135deg, #142740, #101a30); border-color: #36516a; padding: 24px; }
  #homeWelcomeUser { font-size: 1.4rem; line-height: 1.25; max-width: 15ch; }
  #homeLiveClock { font-size: 1.6rem; letter-spacing: -.04em; }
  #viewHome .grid.grid-cols-2 > [onclick] { min-height: 96px; align-items: flex-start; padding: 18px 14px; border-radius: 20px; box-shadow: 0 5px 15px #0002; }
  #viewHome .grid.grid-cols-2 > [onclick] > div:last-child { min-width: 0; overflow-wrap: anywhere; }
  #viewHome .grid.grid-cols-2 > [onclick] .text-xs { font-size: .9rem; }
  button, [role="button"], a[href^="tel:"], a[href^="https://wa"] { min-height: 44px; touch-action: manipulation; }
  button:disabled { opacity: .55; cursor: wait; }
  button:focus-visible, [role="button"]:focus-visible, a:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 3px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea { font-size: 16px !important; min-height: 48px; }
  input, textarea { user-select: text; }
  input::placeholder, textarea::placeholder { color: #94a3b8; }
  select { appearance: none; background-color: #0b1427 !important; color: #e2e8f0 !important; width: 100%; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-right: 32px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-position: right 10px center; background-repeat: no-repeat; }
  textarea { line-height: 1.6 !important; }
  #btnRefresh { width: 44px; height: 44px; flex-shrink: 0; }
  #mobileHeaderMenu { flex-shrink: 0; }
  #mobileHeaderMenu summary { list-style: none; }
  #mobileHeaderMenu summary::-webkit-details-marker { display: none; }
  #mobileHeaderMenu button { width: 100%; justify-content: flex-start; }
  #mobileHeaderMenu button:hover { background: #24374e; }
  #roleBadge { font-size: 10px; }
  #mobileConnectionStatus { font-size: 12px; color: #94a3b8; display: flex; gap: 6px; align-items: center; }
  #mobileConnectionStatus::before { content: ""; width: 6px; height: 6px; background: #34d399; border-radius: 50%; }
  #mobileConnectionStatus[data-offline="true"] { color: #fbbf24; }
  #mobileConnectionStatus[data-offline="true"]::before { background: #fbbf24; }
  body[data-mobile-role="technician"] button[onclick*="openCreateNewEventModal"],
  body[data-mobile-role="technician"] [onclick*="viewQuotes"],
  body[data-mobile-role="technician"] button[onclick*="goToCompanySettings"],
  body[data-mobile-role="technician"] button[onclick*="openQuickPartnerModal"],
  body[data-mobile-role="technician"] #panelHeaderCerts,
  body[data-mobile-role="technician"] #panelHeaderQuotes,
  body[data-mobile-role="technician"] #btnTabHeaderCerts,
  body[data-mobile-role="technician"] #btnTabHeaderQuotes { display: none !important; }
  body[data-mobile-role="technician"] #viewHome > .grid.grid-cols-3 { grid-template-columns: minmax(0, 1fr); }
  #appRoot > nav { background: #0e1a2ef2; border: 1px solid #30425c; border-radius: 24px; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); padding: 4px; box-shadow: 0 12px 40px #0008; max-width: 700px; margin-inline: auto; }
  #bottomNavGrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; max-width: none; padding: 0; }
  .nav-tab { min-height: 60px; justify-content: center; border-radius: 18px; padding: 7px 2px; }
  .nav-tab svg { width: 21px; height: 21px; }
  .nav-tab span { font-size: 10px; font-weight: 600; }
  .nav-tab.active { background: #1c4860; color: #a5e4ff; }
  #viewLogin { min-height: 100dvh; overflow-y: auto; justify-content: safe center; padding-block: max(24px, env(safe-area-inset-top)); background: radial-gradient(ellipse at 50% 0, #174163, transparent 65%), #080f20; }
  #loginForm { border-color: #32465e; box-shadow: 0 20px 70px #0005; }
  #viewLogin h1 { font-size: 26px; letter-spacing: -.04em; }
  #viewLogin p, #viewLogin label, #viewLogin .text-\[11px\] { font-size: 14px; }
  [data-mobile-dialog] { overscroll-behavior: contain; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  [data-mobile-dialog] > div:first-child { max-height: calc(var(--visual-height, 100dvh) - 32px); }
  #modalQuickPartner > div, #modalEditUser > div, #modalSelectCertMaterial > div, #modalSignaturePad > div { overflow-y: auto; }
  [data-mobile-dialog] button[id*="Close"] { min-width: 44px; flex-shrink: 0; }
  #viewAIChat { height: calc(var(--visual-height, 100dvh) - 220px); min-height: 300px; }
  #aiChatInput { min-width: 0; }
  #toastNotification { top: max(18px, env(safe-area-inset-top)); max-width: calc(100vw - 32px); width: max-content; white-space: normal; font-size: 14px; text-align: center; }
  #toastNotification[data-tone="info"] { background: #075985; }
  #toastNotification[data-tone="warning"], #toastNotification[data-tone="error"] { background: #78350f; color: #fef3c7; }
  #toastNotification[data-tone="success"] { background: #065f46; }
  .mobile-section-intro { color: #94a3b8; font-size: 14px; margin-top: 4px; }
  @media (max-width: 480px) {
    #viewCalendar > div:first-child > .flex,
    #viewQuotes > div:first-child,
    #viewReportForm > div:first-child { flex-wrap: wrap; gap: 12px; }
    #calendarDatePickerGroup { display: grid; grid-template-columns: 20px minmax(0, 1fr) 44px; gap: 8px; }
    #calendarDatePickerGroup > span { grid-column: 1 / -1; }
    #calendarDatePickerGroup > svg { grid-column: 1; grid-row: 2; }
    #calendarCustomDate { grid-column: 2; grid-row: 2; width: 100%; min-width: 0; }
    #btnClearDateFilter { grid-column: 3; grid-row: 2; }
  }
  @media (max-width: 390px) {
    #appRoot header > div { padding-inline: 10px; }
    #appRoot header > div > div:first-child { flex: 1; }
    #appRoot header > div > div:last-child { gap: 4px; }
    #appRoot header h1 { font-size: 12px; flex-wrap: wrap; }
    #roleBadge { display: none; }
    #btnHeaderClock { width: 44px; padding-inline: 8px; justify-content: center; }
    #headerClockText { display: none; }
    #viewHome > div:first-child { padding: 18px; }
    #homeWelcomeUser { font-size: 1.15rem; }
    #homeLiveClock { font-size: 1.25rem; }
    #viewHome .grid.grid-cols-2 > [onclick] { flex-direction: column; gap: 10px; }
    #mainContainer .grid.grid-cols-3 { gap: 6px; }
    #viewHome > .grid.grid-cols-3 > div { padding: 10px 8px; }
    #viewHome > .grid.grid-cols-3 .truncate { white-space: normal; overflow: visible; text-overflow: clip; }
    #viewHome > .grid.grid-cols-3 > div > span:first-child { font-size: 10px; min-height: 28px; }
  }
  @media (min-width: 768px) { #appRoot main { padding-top: 28px; } #viewHome .grid.grid-cols-2 { gap: 14px; } }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
}
