/* STT Workspace V14: installable app and touch-first workspace. */
.mobile-app-header,
.mobile-bottom-nav,
.mobile-sidebar-backdrop,
.pwa-sidebar-install,
.pwa-login-install,
.mobile-install-button {
  display: none;
}

[data-pwa-install][hidden],
.mobile-sidebar-backdrop[hidden],
.mobile-bottom-nav i[hidden] {
  display: none !important;
}

.pwa-sidebar-install:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 40px;
  margin-top: 24px;
  padding: 0 11px;
  border: 1px solid rgba(231, 125, 91, 0.25);
  border-radius: 9px;
  background: rgba(231, 125, 91, 0.08);
  color: #e59a7e;
  font-size: 10px;
  font-weight: 650;
  text-align: left;
}

.pwa-sidebar-install span {
  font-size: 17px;
}

.login-page-v13 .login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pwa-login-install:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #f1ede5;
  font-size: 11px;
  font-weight: 650;
}

.pwa-install-guide {
  position: fixed;
  z-index: 80;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: 410px;
  margin-inline: auto;
  padding: 17px 38px 17px 17px;
  border: 1px solid #e7e1d8;
  border-radius: 17px;
  background: #fffdfa;
  color: #262b27;
  box-shadow: 0 20px 60px rgba(12, 16, 13, 0.25);
}

.pwa-install-guide img {
  flex: 0 0 auto;
  border-radius: 13px;
}

.pwa-install-guide b {
  font-size: 13px;
}

.pwa-install-guide p {
  margin: 5px 0 0;
  color: #696d66;
  font-size: 11px;
  line-height: 1.55;
}

.pwa-guide-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #737770;
  font-size: 21px;
}

@media (max-width: 760px) {
  body:not(.login-body) {
    min-height: 100dvh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
    background: #f7f5f1;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .app-shell > .sidebar {
    position: fixed;
    z-index: 42;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(288px, calc(100vw - 54px));
    height: 100dvh;
    padding: calc(20px + env(safe-area-inset-top)) 17px
      calc(17px + env(safe-area-inset-bottom));
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }

  .mobile-nav-open .app-shell > .sidebar {
    transform: translateX(0);
  }

  .sidebar .brand {
    justify-content: flex-start;
    padding: 0 5px 20px;
  }

  .sidebar .brand .stt-brand-logo {
    display: block;
    width: 160px;
  }

  .sidebar .brand .stt-brand-mark {
    display: none;
  }

  .sidebar nav > small {
    display: block;
    font-size: 8px;
  }

  .sidebar nav button {
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 11px;
    font-size: 12px;
  }

  .sidebar nav button em,
  .sidebar .capacity,
  .sidebar .profile > span:nth-child(2),
  .sidebar .profile form {
    display: flex;
  }

  .sidebar nav button em {
    align-items: center;
    justify-content: center;
  }

  .sidebar .capacity {
    display: block;
  }

  .sidebar .profile {
    justify-content: flex-start;
    padding-inline: 7px;
  }

  .mobile-sidebar-backdrop:not([hidden]) {
    position: fixed;
    z-index: 41;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(17, 21, 19, 0.53);
  }

  .app-shell > main {
    min-width: 0;
    padding: calc(14px + env(safe-area-inset-top)) 14px 24px;
  }

  .mobile-app-header {
    display: grid;
    grid-template-columns: 43px minmax(0, 1fr) 43px;
    align-items: center;
    gap: 9px;
    min-height: 55px;
    margin-bottom: 21px;
  }

  .mobile-app-header > img {
    width: 136px;
    height: auto;
    margin-inline: auto;
    filter: brightness(0) saturate(100%);
    opacity: 0.87;
  }

  .mobile-menu-button,
  .mobile-install-button:not([hidden]) {
    display: grid;
    place-content: center;
    width: 43px;
    height: 43px;
    border: 1px solid #e4e0d8;
    border-radius: 12px;
    background: #fff;
    color: #454a45;
  }

  .mobile-menu-button {
    gap: 4px;
  }

  .mobile-menu-button span {
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: #454a45;
  }

  .mobile-install-button {
    font-size: 18px;
  }

  .topbar {
    gap: 15px;
    margin-bottom: 19px;
  }

  .topbar small {
    font-size: 10px;
  }

  .topbar h1 {
    margin-top: 6px;
    font-size: clamp(26px, 7.1vw, 34px);
    font-weight: 650;
    letter-spacing: -0.05em;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 43px auto;
    width: 100%;
    gap: 8px;
  }

  .top-actions .search {
    width: auto;
    height: 43px;
    border-radius: 11px;
  }

  .top-actions .search input {
    display: block;
    font-size: 11px;
  }

  .top-actions .icon-button,
  .top-actions .primary {
    height: 43px;
    border-radius: 11px;
  }

  .top-actions .icon-button {
    width: 43px;
  }

  .top-actions .primary {
    padding-inline: 10px;
    font-size: 10px;
  }

  .stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 15px;
  }

  .stats article {
    min-width: 0;
    min-height: 93px;
    padding: 12px 11px;
    border-radius: 13px;
  }

  .stats article label {
    gap: 6px;
    font-size: 7px;
    letter-spacing: 0.025em;
  }

  .stats article > div {
    align-items: baseline;
    gap: 6px;
  }

  .stats article > div > b {
    font-size: 25px;
  }

  .stats article > div > em {
    font-size: 8px;
  }

  .project-panel,
  .quality-board,
  .calendar-view {
    overflow: visible;
    border-radius: 15px;
  }

  .project-panel > header {
    gap: 12px;
    padding: 17px 14px 14px;
  }

  .project-panel > header h2 {
    font-size: 17px;
  }

  .project-panel > header p {
    font-size: 10px;
    line-height: 1.5;
  }

  .type-filters {
    gap: 5px;
    padding-bottom: 2px;
  }

  .type-filters button {
    min-height: 35px;
    flex: 0 0 auto;
    padding-inline: 10px;
    font-size: 9px;
  }

  .project-panel .table-scroll,
  .project-panel table,
  .project-panel tbody,
  .project-panel tr {
    display: block;
    width: 100%;
  }

  .project-panel thead {
    display: none;
  }

  .project-panel tbody {
    display: grid;
    gap: 10px;
    padding: 11px;
    background: #faf8f5;
  }

  .project-panel tbody tr[data-project] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    padding: 5px 12px 10px;
    border: 1px solid #e8e3da;
    border-radius: 13px;
    background: #fff;
  }

  .project-panel tr[data-project] > td,
  .project-panel tr[data-project] > td:nth-child(3),
  .project-panel tr[data-project] > td:nth-child(6) {
    display: grid;
    align-content: center;
    gap: 4px;
    min-width: 0;
    height: auto;
    min-height: 60px;
    padding: 9px 5px;
    border-bottom: 1px solid #f1eee9;
  }

  .project-panel tr[data-project] > td:first-child {
    grid-column: 1 / -1;
    min-height: 70px;
    padding-inline: 2px;
  }

  .project-panel tr[data-project] > td:nth-child(2) {
    order: 5;
  }

  .project-panel tr[data-project] > td:nth-child(3) {
    order: 1;
  }

  .project-panel tr[data-project] > td:nth-child(4) {
    order: 2;
  }

  .project-panel tr[data-project] > td:nth-child(5) {
    order: 3;
  }

  .project-panel tr[data-project] > td:nth-child(6) {
    order: 4;
  }

  .project-panel tr[data-project] > td:nth-child(7) {
    order: 6;
  }

  .project-panel tr[data-project] > td:nth-child(8) {
    order: 7;
    grid-column: 1 / -1;
    min-height: 52px;
    border-bottom: 0;
  }

  .project-panel tr[data-project] > td:nth-child(9) {
    display: none;
  }

  .project-panel tr[data-project] > td:nth-child(2)::before {
    content: "LOẠI VIỆC";
  }

  .project-panel tr[data-project] > td:nth-child(3)::before {
    content: "NGƯỜI THỰC HIỆN";
  }

  .project-panel tr[data-project] > td:nth-child(4)::before {
    content: "NGÀY QUAY";
  }

  .project-panel tr[data-project] > td:nth-child(5)::before {
    content: "DEADLINE";
  }

  .project-panel tr[data-project] > td:nth-child(6)::before {
    content: "NGÀY GIAO";
  }

  .project-panel tr[data-project] > td:nth-child(7)::before {
    content: "FEEDBACK";
  }

  .project-panel tr[data-project] > td:nth-child(8)::before {
    content: "TRẠNG THÁI";
  }

  .project-panel tr[data-project] > td::before {
    color: #8c8f89;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .project-panel .project-name > i {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  .project-panel .project-name b,
  .project-panel .assignee b,
  .project-panel .schedule-cell b {
    font-size: 11px;
  }

  .project-panel .project-name small,
  .project-panel .assignee small,
  .project-panel .schedule-cell small {
    font-size: 9px;
  }

  .project-panel .sort-handle {
    display: none;
  }

  .project-panel .status.status-picker {
    min-width: 138px;
    min-height: 38px;
    justify-self: start;
    padding-inline: 11px;
    font-size: 10px;
  }

  .project-panel .empty-row,
  .project-panel .loading-row {
    display: grid;
    min-height: 155px;
    place-content: center;
    text-align: center;
  }

  .calendar-heading,
  .calendar-toolbar,
  .calendar-actions {
    flex-wrap: wrap;
  }

  .calendar-heading {
    gap: 12px;
  }

  .calendar-heading h2 {
    font-size: 20px;
  }

  .calendar-actions {
    gap: 8px;
  }

  .calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }

  .calendar-month {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-month .calendar-weekdays,
  .calendar-month .calendar-grid {
    min-width: 620px;
  }

  .calendar-agenda {
    min-width: 0;
  }

  .calendar-week {
    min-width: 0;
  }

  .quality-heading,
  .quality-card-main,
  .quality-card footer {
    flex-wrap: wrap;
  }

  .quality-filter {
    max-width: 100%;
    overflow-x: auto;
  }

  .quality-filter button {
    flex: 0 0 auto;
  }

  .overlay.centered {
    align-items: flex-end;
    padding: 0;
  }

  .overlay .modal {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 960px);
    overflow-y: auto;
    padding: 25px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius: 19px 19px 0 0;
  }

  .overlay .drawer {
    width: 100%;
    max-width: none;
    padding-bottom: calc(25px + env(safe-area-inset-bottom));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid input,
  .form-grid select,
  .task-update input,
  .task-update select,
  .schedule-form input {
    min-height: 43px;
    font-size: 12px;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    min-height: calc(68px + env(safe-area-inset-bottom));
    padding: 7px 5px env(safe-area-inset-bottom);
    border-top: 1px solid #e7e2da;
    background: rgba(255, 254, 251, 0.97);
    box-shadow: 0 -8px 30px rgba(36, 39, 36, 0.05);
    backdrop-filter: blur(15px);
  }

  .mobile-bottom-nav button {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    min-height: 53px;
    padding: 5px 1px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #797c76;
  }

  .mobile-bottom-nav button.active {
    color: #cf6248;
  }

  .mobile-bottom-nav button > span {
    font-size: 18px;
    line-height: 1;
  }

  .mobile-bottom-nav button > small {
    font-size: 9px;
    font-weight: 650;
  }

  .mobile-bottom-nav button > i {
    position: absolute;
    top: 1px;
    right: calc(50% - 22px);
    display: grid;
    min-width: 16px;
    height: 16px;
    place-items: center;
    padding-inline: 4px;
    border-radius: 99px;
    background: #d46b4d;
    color: #fff;
    font-size: 8px;
    font-style: normal;
    font-weight: 750;
  }

  .pwa-install-guide {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .login-body .pwa-install-guide {
    bottom: max(18px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .app-shell > main {
    padding-inline: 10px;
  }

  .stats {
    gap: 7px;
  }

  .stats article {
    padding-inline: 9px;
  }

  .stats article label {
    font-size: 6px;
  }

  .top-actions .primary {
    max-width: 86px;
    overflow: hidden;
    white-space: nowrap;
  }

  .mobile-bottom-nav button > small {
    font-size: 8px;
  }
}

@media (display-mode: standalone) {
  .pwa-login-install,
  .pwa-sidebar-install,
  .mobile-install-button {
    display: none !important;
  }
}
