/**
 * International HR mobile / tablet app shell.
 * Desktop (≥992px) is unchanged — this file only styles phones and tablets.
 */

.ems-tabbar {
  display: none;
}

@media (max-width: 991.98px) {
  html {
    height: 100%;
  }

  body.ems-body:has(> .ems-app) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .ems-app {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0 !important;
    overflow: hidden;
    background: var(--bg);
  }

  .main-content {
    margin-left: 0 !important;
    height: 100%;
    max-height: 100%;
    min-height: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .content-area {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0.7rem 0.75rem calc(5.1rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* —— App bar —— */
  .topbar {
    padding: 0.45rem 0.9rem !important;
    padding-top: calc(0.45rem + env(safe-area-inset-top, 0px)) !important;
    gap: 0.5rem !important;
    flex-wrap: nowrap !important;
    box-shadow: 0 1px 0 var(--border);
    min-height: 3.4rem;
  }

  .topbar-hamburger,
  .topbar-desk-only {
    display: none !important;
  }

  .topbar-m-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid var(--border);
    background: #fff;
  }

  .topbar-m-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .topbar .topbar-title,
  .topbar h1.topbar-title {
    font-family: var(--font-display);
    font-size: 1.05rem !important;
    font-weight: 650;
    letter-spacing: -0.03em;
    max-width: none !important;
    color: var(--text-primary) !important;
  }

  .topbar-actions {
    flex-wrap: nowrap !important;
  }

  .topbar #notifBellBtn {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
  }

  .topbar .notif-dropdown {
    min-width: min(100vw - 1.25rem, 22rem) !important;
    max-width: calc(100vw - 1.25rem);
  }

  /* —— Bottom tab bar —— */
  .ems-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 0.28rem 0.35rem calc(0.28rem + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: stretch;
    box-shadow: 0 -8px 24px rgba(71, 4, 10, 0.06);
  }

  .ems-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-height: 3.15rem;
    padding: 0.2rem 0.15rem;
    border: 0;
    background: transparent;
    color: #8a7578;
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 0.7rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .ems-tab i {
    font-size: 1.28rem;
    line-height: 1;
  }

  .ems-tab.is-active {
    color: #7a0b14;
  }

  .ems-tab.is-active i {
    transform: translateY(-1px);
  }

  .ems-tab:active {
    background: #f7efef;
  }

  /* —— Drawer as app menu —— */
  .sidebar {
    width: min(20.5rem, 88vw);
    box-shadow: 12px 0 40px rgba(71, 4, 10, 0.12);
  }

  .sidebar .sidebar-link {
    min-height: 2.85rem;
    font-size: 0.94rem;
  }

  .company-footer-strip {
    display: none;
  }

  /* —— Dashboard: app home —— */
  .hrms-dash-hero {
    border-bottom: 0;
    margin-bottom: 0.7rem;
    padding-bottom: 0;
    gap: 0.5rem;
  }

  .hrms-mini-tools {
    display: none !important;
  }

  .hrms-dash-section-title,
  .hrms-section1-title {
    display: none !important;
  }

  .hrms-dash-section {
    margin-bottom: 0.75rem;
  }

  .hrms-dash h1.hrms-dash-page-title {
    font-size: 1.22rem;
  }

  .hrms-dash .hrms-dash-sub {
    font-size: 0.8rem;
  }

  /* Compact buttons (override global 2.5rem tap targets) */
  .hrms-dash .btn:not(.btn-link):not(.btn-close),
  .hrms-dash .btn-sm {
    min-height: 1.9rem !important;
    padding: 0.22rem 0.7rem !important;
    font-size: 0.75rem !important;
    line-height: 1.2;
    width: auto;
    border-radius: 999px;
    font-weight: 600;
  }

  .hrms-dash .form-select,
  .hrms-dash .form-select-sm {
    min-height: 1.9rem !important;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
    font-size: 0.75rem !important;
  }

  /* —— Today's attendance (HR clock card) —— */
  .dash-att-card.hrms-att-compact {
    overflow: hidden;
  }

  .dash-att-card-inner {
    border-left: 0;
    background: #fff;
    border-radius: 0;
  }

  .hrms-att-cal-col,
  .dash-att-card .hrms-mini-cal {
    display: none !important;
  }

  .hrms-att-compact .hrms-att-hdr,
  .hrms-att-compact .hdr {
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 0.75rem !important;
    background: #fff;
    border-bottom: 1px solid var(--dash-line);
    padding: 0.75rem 0.9rem !important;
  }

  .hrms-att-hdr-title {
    font-size: 0.84rem;
    font-weight: 650;
    letter-spacing: -0.01em;
  }

  .hrms-att-live-clock {
    flex-shrink: 0;
    font-size: 0.95rem !important;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    font-family: var(--font-display), Outfit, Inter, system-ui, sans-serif;
    line-height: 1;
  }

  .hrms-att-compact .body-tight {
    padding: 0.85rem 0.9rem 1rem !important;
  }

  .hrms-att-date-block {
    margin-bottom: 0.75rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--dash-line);
  }

  .hrms-att-date-strong {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.03em;
  }

  .hrms-att-date-sub {
    font-size: 0.78rem !important;
  }

  .hrms-att-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 1fr 1fr;
    gap: 0.5rem;
  }

  .dash-att-card .hrms-stat-micro {
    min-height: 4.5rem;
    height: 100%;
    padding: 0.65rem 0.7rem !important;
    border-radius: 0.8rem;
    justify-content: space-between;
  }

  .dash-att-card .hrms-stat-micro .k {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  .dash-att-card .hrms-stat-micro .v {
    font-size: 0.8rem;
    min-height: 2.5em;
  }

  .dash-att-card .hrms-att-hours {
    font-size: 0.74rem;
    letter-spacing: -0.02em;
  }

  #dashClockDetail {
    display: none;
  }

  #dashClockMsg:empty {
    display: none;
  }

  .hrms-att-compact .hrms-att-actions,
  .hrms-att-compact .hrms-dash-actions {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 0.5rem !important;
    border-top: 1px solid var(--dash-line) !important;
    padding-top: 0.75rem !important;
    margin-top: 0.85rem !important;
    align-items: stretch;
  }

  .hrms-att-compact .hrms-att-actions .btn,
  .hrms-att-compact .hrms-dash-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 2.75rem !important;
    margin: 0 !important;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    border-radius: 0.7rem;
  }

  .hrms-att-compact .hrms-att-actions a,
  .hrms-att-compact .hrms-dash-actions a {
    display: none !important;
  }

  .dash-week-strip {
    display: block !important;
    margin-top: 0.85rem !important;
    padding-top: 0.75rem !important;
    border-top: 1px solid var(--dash-line) !important;
  }

  .hrms-att-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
  }

  .dash-week-strip .dash-mini-day {
    min-width: 0 !important;
    max-width: none !important;
    padding: 0.35rem 0.1rem 0.3rem;
    border-radius: 0.55rem;
    background: var(--dash-tint);
  }

  .dash-week-strip .dash-mini-day.is-today {
    background: var(--dash-tint-2, #f7eef0);
    box-shadow: inset 0 0 0 1px #d7b4b7;
  }

  .dash-mini-label {
    font-size: 0.52rem;
    margin-top: 0.25rem;
  }

  .dash-mini-num {
    font-size: 0.72rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }

  .hrms-att-selfie {
    padding: 0.65rem 0.65rem calc(5.4rem + env(safe-area-inset-bottom, 0px));
    z-index: 1080;
  }

  .hrms-att-selfie-panel {
    border-radius: 1.15rem 1.15rem 0.9rem 0.9rem;
  }

  .hrms-att-selfie-stage {
    max-height: min(46vh, 20rem);
  }

  /* Bordered cards: one compact shell */
  .hrms-dash .hrms-dash-card,
  .hrms-dash .hrms-dark-feed,
  .hrms-dash .hrms-dark-feed-item,
  .hrms-dash .hrms-dark-feed-highlight,
  .hrms-dash .hrms-stat-micro,
  .hrms-dash .hrms-kpi {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .hrms-dash .hrms-dash-card,
  .hrms-dash .hrms-dark-feed {
    border-radius: 0.85rem;
    overflow: hidden;
    width: 100%;
    box-shadow: 0 1px 2px rgba(71, 4, 10, 0.04);
  }

  .hrms-dash .hrms-dash-card:not(.hrms-att-compact) .hdr {
    padding: 0.6rem 0.85rem !important;
    font-size: 0.82rem;
  }

  .hrms-dash .hrms-dash-card:not(.hrms-att-compact) .body-tight {
    padding: 0.65rem 0.85rem !important;
  }

  .hrms-dash .row.g-3 {
    --bs-gutter-x: 0.65rem;
    --bs-gutter-y: 0.65rem;
    margin-bottom: 0.65rem;
  }

  .hrms-dash .hrms-chart-grid {
    gap: 0.65rem;
  }

  .hrms-dash .hrms-chart-grid .body-tight {
    padding-top: 0.4rem !important;
    padding-bottom: 0.55rem !important;
  }

  .hrms-dash canvas {
    max-width: 100% !important;
  }

  .hrms-dash .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hrms-dash table.table th,
  .hrms-dash table.table td {
    padding: 0.4rem 0.55rem !important;
    font-size: 0.75rem;
  }

  .hrms-selfie-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .hrms-selfie-person {
    padding: 0.55rem 0.55rem 0.65rem;
  }

  .hrms-selfie-thumb,
  .hrms-selfie-none {
    width: 42px;
    height: 42px;
  }

  .hrms-quick-links {
    gap: 0.3rem;
  }

  .hrms-quick-links .btn {
    min-height: 1.75rem !important;
    padding: 0.18rem 0.6rem !important;
    font-size: 0.7rem !important;
  }

  .hrms-feed-pills {
    gap: 0.25rem !important;
  }

  .hrms-feed-pills .nav-link {
    min-height: 1.7rem;
    padding: 0.15rem 0.5rem !important;
    font-size: 0.68rem !important;
  }

  .hrms-dark-feed-head {
    padding: 0.55rem 0.75rem !important;
  }

  .hrms-dark-feed-head .d-flex {
    gap: 0.4rem !important;
  }

  .hrms-dark-feed-title {
    font-size: 0.82rem;
  }

  .hrms-dark-feed-select {
    max-width: none;
    flex: 1 1 7.5rem;
    min-width: 0;
  }

  .hrms-dark-feed-highlight {
    margin: 0.65rem 0.75rem 0.45rem !important;
    padding: 0.65rem 0.7rem !important;
  }

  .hrms-dark-feed-scroll {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-bottom: 0.7rem !important;
    max-height: min(20rem, 44vh);
  }

  .hrms-dark-feed-item {
    padding: 0.55rem 0.7rem !important;
    margin-bottom: 0.4rem !important;
    border-radius: 0.65rem !important;
  }

  .dash-profile-card .btn,
  .hrms-profile-summary-cta {
    min-height: 1.9rem !important;
    margin-top: 0.55rem !important;
    width: auto;
  }

  .hrms-profile-summary-photo {
    width: 56px;
    height: 56px;
    border-radius: 50% !important;
  }

  .ems-profile-avatar {
    width: 76px !important;
    height: 76px !important;
    border-radius: 50% !important;
  }

  .hrms-profile-summary-pills .badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.22rem 0.45rem;
  }

  .ems-profile .card {
    border-radius: 0.85rem;
    overflow: hidden;
  }

  .ems-profile-hero .card-body {
    padding: 0.9rem 0.95rem;
  }

  .hrms-dash-section:has(.hrms-kpi-grid) {
    margin-bottom: 0.85rem;
  }

  .hrms-dash .hrms-dash-card.mt-3 {
    margin-top: 0.65rem !important;
  }

  .hrms-feed-item-title,
  .hrms-highlight-title,
  .hrms-dash .text-break {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .hrms-dash--mgmt .hrms-kpi-grid,
  .hrms-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    margin-top: 1.25rem !important;
    margin-bottom: 0.75rem !important;
  }

  .hrms-kpi {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.2rem;
    min-height: 4.35rem;
    padding: 0.65rem 0.7rem 0.55rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    box-shadow: none;
    overflow: hidden;
  }

  .hrms-kpi-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.4rem;
    font-size: 0.78rem;
  }

  .hrms-kpi-body {
    padding-right: 1.7rem;
  }

  .hrms-kpi .v {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    line-height: 1.05;
  }

  .hrms-kpi .l {
    margin-top: 0.12rem;
    font-size: 0.6875rem;
    line-height: 1.25;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hrms-kpi-label-full {
    display: none;
  }

  .hrms-kpi-label-short {
    display: inline;
  }

  .hrms-kpi.hrms-accent-primary,
  .hrms-kpi.hrms-accent-success,
  .hrms-kpi.hrms-accent-warning,
  .hrms-kpi.hrms-accent-muted,
  .hrms-kpi.hrms-accent-danger,
  .hrms-kpi.hrms-accent-info {
    border-left: 0;
  }

  .hrms-kpi.hrms-accent-primary {
    background: #f7eef0;
    box-shadow: inset 0 2px 0 #7a0b14;
  }

  .hrms-kpi.hrms-accent-success {
    background: #eef7f1;
    box-shadow: inset 0 2px 0 #2f8a4e;
  }

  .hrms-kpi.hrms-accent-warning {
    background: #fbf6e8;
    box-shadow: inset 0 2px 0 #b8860b;
  }

  .hrms-kpi.hrms-accent-muted {
    background: #f4f1f1;
    box-shadow: inset 0 2px 0 #b7adae;
  }

  .hrms-kpi.hrms-accent-danger {
    background: #faf0ee;
    box-shadow: inset 0 2px 0 #c0392b;
  }

  .hrms-kpi.hrms-accent-info {
    background: #eef3f8;
    box-shadow: inset 0 2px 0 #3d6d99;
  }

  .hrms-dash--employee .hrms-dash {
    gap: 0.75rem;
  }
}

@media (max-width: 359.98px) {
  .hrms-kpi-icon {
    display: none;
  }

  .hrms-kpi-body {
    padding-right: 0;
  }

  .hrms-kpi {
    min-height: 3.75rem;
    padding: 0.55rem 0.6rem 0.5rem;
  }

  .hrms-kpi .v {
    font-size: 1.22rem;
  }
}

/* Phones */
@media (max-width: 767.98px) {
  .hrms-dash--employee .hrms-mob-order-section1,
  .hrms-dash--mgmt .hrms-mob-order-section1 {
    display: contents;
  }

  .hrms-dash--employee .hrms-top-row,
  .hrms-dash--mgmt .hrms-top-row {
    display: contents;
  }

  .hrms-mob-clock-wrap,
  .hrms-news-aside-wrap {
    margin-bottom: 0.65rem;
  }

  .content-area .card,
  .hrms-dash-card,
  .hrms-dark-feed {
    border-radius: 0.85rem;
  }

  .hrms-dash [class*="col-lg-"],
  .hrms-dash [class*="col-xl-"],
  .hrms-dash [class*="col-md-"] {
    max-width: 100%;
  }

  .hrms-dash .list-unstyled li {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 991.98px) {
  .content-area {
    padding: 1rem 1.25rem calc(5.4rem + env(safe-area-inset-bottom, 0px)) !important;
    max-width: 56rem;
    margin: 0 auto;
    width: 100%;
  }

  .hrms-dash--employee .hrms-mob-order-section1,
  .hrms-dash--mgmt .hrms-mob-order-section1 {
    display: block;
  }

  .hrms-dash--employee .hrms-top-row,
  .hrms-dash--mgmt .hrms-top-row {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1rem;
  }

  .hrms-dash--employee .hrms-emp-profile-att-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .hrms-dash--employee .hrms-emp-profile-att-row > [class*="col-"] {
    width: auto;
    max-width: none;
    flex: none;
  }

  .hrms-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.55rem !important;
  }

  .hrms-kpi {
    min-height: 4.6rem;
    padding: 0.7rem 0.75rem 0.6rem;
  }

  .hrms-chart-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .ems-tab {
    font-size: 0.7rem;
    min-height: 3.35rem;
  }

  .ems-tab i {
    font-size: 1.35rem;
  }
}

@media (min-width: 992px) {
  .ems-tabbar,
  .topbar-m-avatar {
    display: none !important;
  }
}
