/* HUB Mobile 2.0 / Табель.
 * Presentation-only controls; the existing attendance.js remains responsible
 * for editing, permissions, persistence, calculations and calendar rules.
 */
.mobile-attendance-tools-toggle,.mobile-attendance-period {display:none}
@media(max-width:680px){
  .attendance-app{padding:8px!important;gap:9px!important;min-width:0;max-width:100%}
  .attendance-route-toolbar{display:block!important;padding:9px!important;min-width:0}
  .attendance-route-toolbar .attendance-toolbar-main {
    display:flex!important;flex-flow:row wrap!important;
    align-items:center!important;justify-content:flex-start!important;
    min-width:0;width:100%;gap:7px!important;
  }
  .mobile-attendance-tools-toggle{
    display:inline-flex;align-items:center;justify-content:center;gap:7px;
    flex:1 1 auto;min-height:44px;border:1px solid var(--line);border-radius:11px;
    padding:0 12px;background:var(--accent-soft);color:var(--accent);
    font:800 12px/1.25 inherit;cursor:pointer
  }
  #saveBtn,#approveBtn{
    display:inline-flex!important;min-height:44px!important;
    flex:0 0 auto;padding:0 10px!important;font-size:11px!important
  }
  .attendance-route-toolbar:not(.mobile-tools-open) .attendance-toolbar-main > :not(.mobile-attendance-tools-toggle):not(#saveBtn):not(#approveBtn){
    display:none!important;
  }
  .attendance-route-toolbar.mobile-tools-open .attendance-toolbar-main > :not(.mobile-attendance-tools-toggle):not(#saveBtn):not(#approveBtn) {
    flex:1 1 135px;min-width:0
  }
  .attendance-route-toolbar.mobile-tools-open .attendance-toolbar-main > .attendance-search,
  .attendance-route-toolbar.mobile-tools-open .attendance-toolbar-main > .attendance-month-note {
    flex:1 1 100%;min-width:0;width:100%
  }
  .attendance-route-toolbar.mobile-tools-open .attendance-toolbar-main > .attendance-period input,
  .attendance-route-toolbar.mobile-tools-open .attendance-toolbar-main > .attendance-department select{
    width:100%;min-width:0;max-width:100%
  }
  .attendance-route-toolbar.mobile-tools-open .attendance-toolbar-main > .attendance-period,
  .attendance-route-toolbar.mobile-tools-open .attendance-toolbar-main > .attendance-department {
    width:100%;min-width:0;display:flex;justify-content:space-between;
  }
  .attendance-route-toolbar .attendance-toolbar-main button,
  .attendance-route-toolbar .attendance-toolbar-main summary,
  .attendance-route-toolbar .attendance-toolbar-main input,
  .attendance-route-toolbar .attendance-toolbar-main select {min-height:40px}
  .summary-panel{padding:0}
  .summary-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important;padding:10px!important}
  .summary-grid .metric{min-width:0;padding:9px!important;gap:4px}
  .summary-grid .metric span{font-size:9px;overflow-wrap:anywhere}
  .summary-grid .metric strong{font-size:clamp(16px,4.4vw,22px);overflow-wrap:anywhere}
  .summary-grid .metric small{display:none}
  .mobile-attendance-period{
    display:grid;gap:8px;padding:10px;max-width:100%;min-width:0;
    border-radius:15px
  }
  .mobile-attendance-view{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
  .mobile-attendance-view button{
    min-width:0;min-height:42px;border:1px solid var(--line);
    border-radius:10px;background:var(--panel);color:var(--text);
    font:800 12px/1.2 inherit;cursor:pointer
  }
  .mobile-attendance-view button[aria-pressed="true"]{
    border-color:var(--accent);background:var(--accent-soft);color:var(--accent)
  }
  .mobile-attendance-navigation{
    display:flex;align-items:center;justify-content:space-between;gap:7px;
    min-width:0;min-height:43px
  }
  .mobile-attendance-navigation button{
    display:grid;place-items:center;width:42px;height:42px;flex:0 0 42px;
    border:1px solid var(--line);border-radius:10px;
    background:var(--panel);color:var(--text);font-size:25px;cursor:pointer
  }
  .mobile-attendance-navigation button:disabled{opacity:.32}
  #mobileAttendanceRange{
    flex:1 1 0;min-width:0;text-align:center;
    font-size:12px;font-weight:800;color:var(--text);overflow-wrap:anywhere
  }
  .table-headline{padding:10px!important;gap:8px!important}
  .table-head-controls{gap:5px!important;flex-wrap:wrap}
  .table-head-controls #quickFillBtn,.table-head-controls #refreshBtn,.table-head-controls #settingsBtn{
    min-height:42px!important
  }
  .table-head-controls .legend-inline{display:none!important}
  .timesheet-card{min-width:0!important;max-width:100%!important}
  .timesheet-scroll {
    width:100%!important;max-width:100%!important;min-width:0!important;
    overflow-x:auto!important;overflow-y:visible!important;
    -webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;
    scrollbar-width:thin;
  }
  .timesheet-table{width:max-content!important;min-width:100%!important;border-collapse:separate}
  .timesheet-table th,.timesheet-table td{font-size:10px}
  .timesheet-table .person-col{
    width:130px!important;min-width:130px!important;max-width:130px!important;
    position:sticky!important;left:0!important;text-align:left;
    white-space:normal!important;padding:5px!important;
  }
  .timesheet-table .employee-cell{min-width:0!important;gap:5px!important}
  .timesheet-table .employee-name{min-width:0!important}
  .timesheet-table .employee-name b{white-space:normal!important;overflow-wrap:anywhere;font-size:10px!important}
  .timesheet-table .employee-name small{font-size:8px!important}
  .timesheet-table .avatar{width:23px;height:23px;font-size:8px}
  .timesheet-table .position-col,.timesheet-table .norm-col,.timesheet-table .summary-col,
  .timesheet-table .comment-col {display:none!important}
  .timesheet-table .fact-col{
    width:43px!important;min-width:43px!important;max-width:43px!important;
    position:sticky!important;left:130px!important;
    z-index:5!important;padding:3px!important;box-shadow:3px 0 7px #0001
  }
  .timesheet-table thead .person-col,.timesheet-table thead .fact-col {
    z-index:15!important;background:var(--group)!important
  }
  .timesheet-table .day-col{width:40px!important;min-width:40px!important;max-width:40px!important}
  .timesheet-table .day-button{width:34px!important;height:36px!important;min-height:36px!important}
  .timesheet-table .day-col.mobile-attendance-outside-window {display:none!important}
  .timesheet-table tr.department-row>td{
    position:static!important;display:table-cell!important;
    max-width:100%;background:var(--group)
  }
  .day-popover:not([hidden]){
    position:fixed!important;inset:auto 8px 8px 8px!important;
    top:auto!important;bottom:max(8px,env(safe-area-inset-bottom))!important;
    left:8px!important;right:8px!important;
    width:auto!important;max-width:none!important;
    max-height:min(75dvh,630px)!important;overflow-y:auto!important;
    border-radius:17px!important;z-index:10000!important
  }
  .audit-card{width:calc(100vw - 16px);max-width:100%;max-height:90dvh}
  .settings-panel{left:8px!important;right:8px!important;max-height:85dvh!important}
}
@media(max-width:350px){
  .timesheet-table .person-col{width:113px!important;min-width:113px!important;max-width:113px!important}
  .timesheet-table .fact-col{left:113px!important}
  .summary-grid{gap:4px!important;padding:7px!important}
  .summary-grid .metric{padding:7px!important}
  .attendance-route-toolbar .attendance-toolbar-main{gap:4px!important}
}


/* Explicit full-month fallback exposes every original editable column. */
@media(max-width:680px){
  .timesheet-table[data-mobile-attendance-view="month"] .position-col,
  .timesheet-table[data-mobile-attendance-view="month"] .norm-col,
  .timesheet-table[data-mobile-attendance-view="month"] .summary-col,
  .timesheet-table[data-mobile-attendance-view="month"] .comment-col {
    display:table-cell!important;
  }
  .timesheet-table[data-mobile-attendance-view="month"] .position-col,
  .timesheet-table[data-mobile-attendance-view="month"] .norm-col {
    position:static!important;left:auto!important;
    min-width:75px!important;width:auto!important;max-width:160px!important;
  }
  .timesheet-table[data-mobile-attendance-view="month"] .comment-col{
    min-width:170px!important;width:170px!important;max-width:170px!important;
  }
  .timesheet-table[data-mobile-attendance-view="month"] .fact-col{
    position:static!important;left:auto!important;
    min-width:48px!important;
  }
}
