/* ==========================================================================
   Cogent HR - shared layout: navigation, mobile, offline
   ========================================================================== */

/* ---------- Brand accent + header ---------- */
.navbar{border-bottom:3px solid #f15a22;gap:1rem}
.navbar .navbar-brand{flex-shrink:0}
.navbar .navbar-brand img{display:block}

/* ---------- Navigation (desktop) ---------- */
nav.hr-nav{display:flex;align-items:center;justify-content:flex-end;min-width:0}
.hr-nav-toggle{display:none}
.hr-nav-items{display:flex;gap:.25rem;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.navbar nav.hr-nav .hr-nav-items>a,.navbar nav.hr-nav .hr-dd-btn{color:#fff!important;text-decoration:none;padding:.6rem .85rem!important;border-radius:8px;font-weight:600;font-size:.92rem!important;background:transparent!important;border:0;cursor:pointer;font-family:inherit;display:inline-flex;align-items:center;white-space:nowrap;line-height:1.2;margin:0!important}
.navbar nav.hr-nav .hr-nav-items>a:hover,.navbar nav.hr-nav .hr-nav-items>a.active,.navbar nav.hr-nav .hr-dd:hover>.hr-dd-btn,.navbar nav.hr-nav .hr-dd.open>.hr-dd-btn,.navbar nav.hr-nav .hr-dd.active>.hr-dd-btn{background:rgba(255,255,255,.16)!important}
.navbar nav.hr-nav a .ico,.navbar nav.hr-nav .hr-dd-btn .ico{margin-right:.45em!important;width:1.1em}
.navbar nav.hr-nav .hr-nav-items>a.hr-icon-only .ico{margin-right:0!important}
.hr-dd{position:relative}
.hr-caret{font-size:.7em;margin-left:.45em;opacity:.8;transition:transform .2s}
.hr-dd-menu{display:none;position:absolute;right:0;top:calc(100% + 4px);min-width:240px;background:#fff;border-radius:10px;box-shadow:0 12px 32px rgba(2,48,71,.22);padding:.4rem;z-index:1000;border-top:3px solid #f15a22}
.hr-dd::after{content:"";position:absolute;left:0;right:0;top:100%;height:6px}
@media (hover:hover) and (min-width:901px){.hr-dd:hover .hr-dd-menu{display:block}}
.hr-dd.open .hr-dd-menu{display:block}
.navbar nav.hr-nav .hr-dd-menu a{display:flex!important;align-items:center;color:#1e293b!important;background:transparent!important;padding:.6rem .75rem!important;border-radius:6px!important;font-weight:500!important;font-size:.9rem!important;text-decoration:none;white-space:nowrap;margin:0!important}
.navbar nav.hr-nav .hr-dd-menu a .ico{color:#0b4f6c}
.navbar nav.hr-nav .hr-dd-menu a:hover{background:#eef5f8!important}
.navbar nav.hr-nav .hr-dd-menu a.active{background:#e1edf2!important;color:#023047!important;font-weight:700!important}
.hr-badge{display:inline-block;min-width:1.35em;padding:.1em .45em;margin-left:.45em;border-radius:999px;background:#f15a22;color:#fff;font-size:.72rem;font-weight:700;text-align:center;line-height:1.35}
@media (max-width:1280px){.navbar nav.hr-nav .hr-nav-items>a,.navbar nav.hr-nav .hr-dd-btn{padding:.55rem .6rem!important;font-size:.88rem!important}}

/* ---------- Navigation (tablet / phone) ---------- */
@media (max-width:900px){
  .navbar{flex-direction:row!important;flex-wrap:wrap!important;align-items:center!important;justify-content:space-between!important;padding:.6rem 1rem!important;position:sticky;top:0;z-index:1000}
  .navbar .navbar-brand img,.navbar .company-logo{height:40px!important;padding:.35rem!important}
  nav.hr-nav{flex:0 0 auto;width:auto!important;margin:0!important;padding:0!important}
  .hr-nav-toggle{display:inline-flex;align-items:center;justify-content:center;position:relative;width:44px;height:44px;border:0;border-radius:10px;background:rgba(255,255,255,.14);color:#fff;font-size:1.25rem;cursor:pointer}
  .hr-nav-toggle .hr-badge-dot{position:absolute;top:2px;right:0;margin:0;font-size:.62rem;padding:.05em .35em}
  .hr-nav-items{display:none;position:fixed;left:0;right:0;top:var(--hr-nav-top,64px);bottom:0;overflow-y:auto;-webkit-overflow-scrolling:touch;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:0;background:#023047;padding:.5rem .75rem 2rem;box-shadow:0 12px 24px rgba(0,0,0,.25);z-index:999}
  nav.hr-nav.open .hr-nav-items{display:flex}
  .navbar nav.hr-nav .hr-nav-items>a,.navbar nav.hr-nav .hr-dd-btn{width:100%;justify-content:flex-start;padding:.85rem .75rem!important;font-size:1rem!important;border-radius:8px;min-height:44px}
  .navbar nav.hr-nav .hr-nav-items>a.hr-icon-only::after{content:"Notifications";margin-left:.6em}
  .navbar nav.hr-nav .hr-nav-items>a.hr-icon-only .hr-badge{order:2}
  .hr-dd{width:100%}
  .hr-dd::after{display:none}
  .hr-dd-btn .hr-caret{margin-left:auto}
  .hr-dd.open .hr-caret{transform:rotate(180deg)}
  .hr-dd-menu{position:static;box-shadow:none;border:0;border-radius:8px;background:rgba(255,255,255,.06);margin:.15rem 0 .4rem;padding:.25rem;min-width:0}
  .navbar nav.hr-nav .hr-dd-menu a{color:#e2e8f0!important;padding:.75rem .9rem!important;font-size:.95rem!important;min-height:44px}
  .navbar nav.hr-nav .hr-dd-menu a .ico{color:#ffb347}
  .navbar nav.hr-nav .hr-dd-menu a:hover,.navbar nav.hr-nav .hr-dd-menu a.active{background:rgba(255,255,255,.12)!important;color:#fff!important}
  body.hr-menu-open{overflow:hidden}
}

/* ---------- General mobile layout ---------- */
img,video,canvas{max-width:100%}
.hr-table-scroll{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.hr-table-scroll>table{min-width:100%}
@media (max-width:768px){
  .container,.main-container,.content,.page-container{padding-left:1rem!important;padding-right:1rem!important;max-width:100%!important;box-sizing:border-box}
  .card,.section,.panel{padding:1.1rem!important;border-radius:12px!important}
  h1{font-size:1.45rem!important}
  h2{font-size:1.25rem!important}
  input,select,textarea{font-size:16px!important;max-width:100%}
  .btn,button[type=submit]{min-height:44px}
  .stats-grid,.stat-grid,.balance-grid,.balance-cards,.content-grid,.form-grid,.form-row,.grid,.grid-2,.grid-3,.two-col,.qa-groups,.filters,.filter-row,.filter-grid{grid-template-columns:1fr!important}
  .form-row,.filter-row,.filters{flex-direction:column!important;align-items:stretch!important}
  .form-row>*,.filter-row>*,.filters>*{width:100%!important;max-width:100%!important}
  .modal-content{width:94vw!important;max-width:94vw!important;margin:3vh auto!important}
}

/* ---------- Offline ---------- */
.hr-offline-bar{position:fixed;left:0;right:0;bottom:0;z-index:2000;display:none;align-items:center;gap:.6rem;justify-content:center;padding:.7rem 1rem;background:#1e293b;color:#fff;font-weight:600;font-size:.9rem;box-shadow:0 -6px 18px rgba(0,0,0,.25)}
.hr-offline-bar .ico{color:#ffb347}
body.hr-offline .hr-offline-bar{display:flex}
body.hr-offline{padding-bottom:3rem}
.hr-toast{position:fixed;left:50%;bottom:4.5rem;transform:translateX(-50%);z-index:2001;background:#991b1b;color:#fff;padding:.75rem 1.1rem;border-radius:10px;font-weight:600;font-size:.9rem;box-shadow:0 8px 24px rgba(0,0,0,.25);max-width:92vw;text-align:center}
.hr-install-btn{display:none}

/* ---------- Page-specific phone fixes ---------- */
@media (max-width:768px){
  /* Dashboard stat cards */
  .stats-grid{gap:.75rem!important}
  .stat-card{min-width:0!important;padding:1rem!important;gap:.75rem!important}
  .stat-card .stat-icon{width:44px!important;height:44px!important;min-width:44px!important;font-size:1.1rem!important}
  .stat-info{min-width:0}
  .stat-info h3{font-size:1.4rem!important}
  .stat-info p{font-size:.78rem!important;white-space:normal!important}

  /* Month calendars (My Leave, Leave Calendar) */
  .calendar-header{flex-direction:column!important;align-items:stretch!important;gap:.75rem!important}
  .calendar-nav{flex-wrap:wrap;justify-content:space-between;gap:.5rem!important;width:100%}
  .calendar-nav h3,.calendar-nav h2{font-size:1rem!important;flex:1 1 100%;order:-1;text-align:center;margin:0!important}
  .calendar-nav .nav-btn,.calendar-nav a,.calendar-nav button{padding:.55rem .8rem!important;font-size:.85rem!important}
  .calendar-grid{padding:.6rem!important;border-radius:12px!important}
  .calendar-weekdays,.calendar-days{grid-template-columns:repeat(7,minmax(0,1fr))!important;gap:3px!important}
  .weekday{padding:.35rem 0!important;font-size:.68rem!important;overflow:hidden;text-overflow:clip}
  .calendar-day{min-width:0!important;width:auto!important;min-height:54px!important;aspect-ratio:auto!important;padding:3px!important;border-width:1px!important;border-radius:6px!important;overflow:hidden}
  .calendar-day:hover{transform:none!important}
  .day-number{font-size:.75rem!important}
  .leave-indicator,.holiday-indicator,.leave-badge,.calendar-day .leave-item{font-size:.55rem!important;padding:1px 2px!important;margin-top:2px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;max-width:100%!important;border-radius:3px!important;line-height:1.3!important}
  .legend,.calendar-legend{flex-wrap:wrap!important;gap:.5rem!important;font-size:.8rem}

  /* Button rows / headers that must wrap */
  .header-actions,.page-header,.notification-actions,.actions,.action-buttons,.btn-group,.card-header{flex-wrap:wrap!important;gap:.5rem!important}
  .page-header,.card-header{align-items:flex-start!important}
  .notification-item{flex-wrap:wrap}
  .notification-actions{width:100%}

  /* Settings tabs scroll sideways */
  .settings-tabs,.tabs,.tab-buttons{overflow-x:auto!important;flex-wrap:nowrap!important;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .settings-tabs::-webkit-scrollbar{display:none}
  .tab-button{flex:0 0 auto!important;white-space:nowrap}

  /* Long code / text */
  code,pre{white-space:pre-wrap!important;word-break:break-all}
  td,th{word-break:normal}
}
@media (max-width:480px){
  .stats-grid{grid-template-columns:1fr!important}
}
/* Grid children must be allowed to shrink so wide tables scroll inside their card */
.content-grid>*,.stats-grid>*,.dashboard-grid>*,.grid>*{min-width:0}
.table-wrapper,.table-container,.table-responsive{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}

/* ---------- Form fields: never wider than their card (iOS Safari date/time fields have a native min-width) ---------- */
input,select,textarea{max-width:100%;box-sizing:border-box}
input[type=date],input[type=time],input[type=datetime-local],input[type=month]{
  -webkit-appearance:none;appearance:none;display:block;width:100%;min-width:0;max-width:100%;
  min-height:3rem;line-height:1.25;background-color:#fff;text-align:left;
}
input[type=date]::-webkit-date-and-time-value,input[type=time]::-webkit-date-and-time-value{text-align:left;margin:0;min-height:1.25em}
input[type=date]::-webkit-calendar-picker-indicator{opacity:.65;cursor:pointer}
.form-group,.form-row>*,.form-grid>*{min-width:0}
