/* Phone-first rental UI. Container queries also cover desktop phone preview. */
.stage {
  height: 100dvh;
}
.nt-workspace,
.tenant-workspace {
  container-type: inline-size;
  min-width: 0;
}
.nt-phone-nav,
.mobile-record-toggle,
.mobile-only-cell {
  display: none;
}
.nt-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.nt-search label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}
.nt-search input {
  font: inherit;
  font-size: 16px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  width: 100%;
}
.nt-list-results .post[hidden],
.mobile-records tr[hidden] {
  display: none !important;
}
.nt-quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}
.nt-quick button {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-2);
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  padding: 16px 10px;
  font-weight: 600;
  min-height: 56px;
}
.nt-house-money {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.nt-house-money span {
  font-size: 12px;
  color: var(--ink-3);
}
.nt-house-money b {
  display: block;
  color: var(--ink);
  font-size: 15px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.nt-task {
  appearance: none;
  color: var(--ink);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
}
.nt-task b {
  font-size: 19px;
}
.nt-task > span:last-child {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 600;
}
.nt-activity > div,
.nt-file-row,
.nt-person-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.nt-activity > div:last-child,
.nt-file-row:last-child,
.nt-person-link:last-child {
  border-bottom: 0;
}
.nt-activity > div b,
.nt-file-row > span,
.nt-person-link > b {
  flex: 1;
}
.nt-activity > div span:last-child {
  text-align: right;
}
.nt-person-link {
  appearance: none;
  background: transparent;
  color: var(--ink);
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.nt-person-link span,
.nt-file-row small {
  display: block;
}
.nt-detail-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.nt-detail-hero h2 {
  margin: 10px 0 4px;
}
.nt-detail-hero p {
  margin: 0;
  color: var(--ink-3);
}
.nt-detail-hero .rowacts {
  justify-content: flex-end;
}
.nt-line-items > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.nt-line-items small {
  display: block;
  margin-top: 3px;
}
.nt-line-items .total {
  border-bottom: 0;
  font-size: 18px;
}
.nt-contract-paper {
  max-width: 794px;
  margin: 16px auto 0;
  padding: clamp(18px, 5vw, 56px);
}
.nt-contract-paper pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 15px/1.65 Georgia, "Times New Roman", serif;
  color: var(--ink);
}
.nt-data-list {
  margin: 0;
}
.nt-data-list > div {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) 1.3fr;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.nt-data-list dt {
  color: var(--ink-3);
}
.nt-data-list dd {
  margin: 0;
  font-weight: 600;
}
.nt-report-details summary {
  cursor: pointer;
  min-height: 44px;
  display: list-item;
  align-content: center;
  font-weight: 600;
}
.nt-meter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 14px;
}
.nt-meter-room header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.nt-meter-room h3 {
  font-size: 18px;
  margin: 0;
}
.nt-meter-room header p {
  margin: 4px 0 0;
  color: var(--ink-3);
}
.nt-meter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.nt-meter .nt-meter-room input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  font-size: 20px;
  font-family: var(--f-num);
  font-weight: 500;
}
.nt-meter input[aria-invalid="true"] {
  border-color: var(--neg);
  background: var(--neg-soft);
}
.nt-meter-usage {
  min-height: 20px;
  color: var(--accent-2);
  overflow-wrap: anywhere;
}
.nt-meter-result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.nt-meter-result b {
  font-size: 17px;
  overflow-wrap: anywhere;
}
.nt-draft-status {
  margin: 8px 0 0;
}
.nt-meter-submit {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 0;
  margin: 10px 0 22px;
}
.nt-meter-submit > span {
  flex: 1;
  min-width: 140px;
  font-size: 13px;
  color: var(--ink-3);
}
.nt-meter h2 {
  font-size: 18px;
  margin: 0;
}
.nt-batch-tools {
  align-items: end;
  margin: 12px 0 16px;
}
.nt-batch-tools label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-3);
}
.nt-batch-tools select {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.nt-draft-global {
  margin-left: auto;
}
.nt-fixed-fees {
  padding: 12px 0;
  overflow-wrap: anywhere;
}
.nt-room-extra {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.nt-room-extra summary {
  min-height: 44px;
  align-content: center;
  cursor: pointer;
  font-weight: 600;
}
.nt-extra-fields {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding-bottom: 14px;
}
.nt-extra-fields input {
  width: 100%;
}
.nt-meter-room[data-status="error"] {
  border-color: var(--warn);
}
.nt-meter-photos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 12px;
}
.nt-close-log > summary {
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
}
.nt-close-log > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.nt-close-log > div span {
  text-align: right;
}
.tenant-app .tabbar {
  display: flex;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 6px 4px max(8px, env(safe-area-inset-bottom));
  z-index: 50;
}
.tenant-app .tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  font-size: 11px;
  color: var(--ink-3);
}
.tenant-app .tabbar button.on {
  color: var(--accent-2);
  background: var(--accent-soft);
  border-radius: 10px;
}
.tro-more .row {
  justify-content: space-between;
  margin-bottom: 14px;
}
.tro-more .grid {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tro-more .btn {
  min-height: 52px;
}
.tro-more[hidden] {
  display: none;
}
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
:where(button, a, summary) {
  touch-action: manipulation;
}
@container (max-width:720px) {
  .nt-workspace .nt-tabs {
    display: none;
  }
  .nt-phone-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 18px;
  }
  .nt-phone-nav label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
  }
  .nt-phone-nav select {
    min-height: 48px;
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: var(--surface);
    width: 100%;
    min-width: 0;
    margin-bottom: 6px;
  }
  .nt-workspace .page-h .psub {
    margin-bottom: 0;
  }
  .nt-workspace .page-h .btn {
    min-height: 44px;
  }
  .nt-workspace .g4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .nt-workspace .g3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .nt-workspace .g2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .nt-detail-hero {
    flex-direction: column;
  }
  .nt-detail-hero .rowacts,
  .nt-detail-hero .rowacts .btn {
    width: 100%;
  }
  .nt-detail-hero .rowacts .btn {
    justify-content: center;
  }
  .nt-data-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
  .nt-line-items > div {
    align-items: flex-start;
  }
  .nt-workspace .k-v {
    font-size: 18px;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .nt-quick {
    gap: 8px;
    margin-bottom: 16px;
  }
  .nt-quick button {
    flex-direction: column;
    font-size: 12px;
    padding: 12px 3px;
    gap: 8px;
    min-height: 80px;
  }
  .nt-quick button span {
    text-align: center;
    text-wrap: balance;
  }
  .nt-house .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
  :is(.nt-workspace, .tenant-workspace)
    :is(button.btn, button.tbtn, button.pill, .iconbtn, summary) {
    min-height: 44px;
    min-width: 44px;
  }
  .tenant-workspace .nut-anh {
    min-height: 44px;
  }
  .tenant-workspace #pa_gui {
    min-height: 48px;
    width: 100%;
    justify-content: center;
  }
  .tenant-workspace .hd-row {
    gap: 12px;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
  }
  :is(.nt-workspace, .tenant-workspace) :is(input, select, textarea) {
    font-size: 16px;
    min-height: 48px;
    max-width: 100%;
  }
  :is(.nt-workspace, .tenant-workspace) .rowacts {
    flex-wrap: wrap;
  }
  :is(.nt-workspace, .tenant-workspace) .nt-toolbar label {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .nt-toolbar input {
    flex: 1;
    min-width: 0;
  }
  .nt-meter-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .nt-meter {
    padding: 0;
  }
  .nt-meter-fields {
    gap: 12px;
  }
  .nt-batch-tools {
    align-items: stretch;
  }
  .nt-batch-tools > :is(label, .btn) {
    width: 100%;
  }
  .nt-batch-tools .btn {
    justify-content: center;
  }
  .nt-draft-global {
    margin-left: 0;
  }
  .nt-extra-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .nt-meter-photos {
    align-items: flex-start;
    flex-direction: column;
  }
  .nt-close-log > div {
    flex-direction: column;
    gap: 4px;
  }
  .nt-close-log > div span {
    text-align: left;
  }
  .nt-meter-submit {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--sh-1);
    z-index: 10;
  }
  .nt-meter-submit > span {
    flex: 1 0 100%;
    font-size: 12px;
  }
  .nt-meter-submit > .btn {
    flex: 1;
    justify-content: center;
    min-height: 48px;
  }
  .nt-meter-submit > .btn.gh {
    flex: 0 1 auto;
    font-size: 12px;
  }
  .mobile-record-wrap {
    border: 0;
    background: none;
    border-radius: 0;
    overflow: visible;
  }
  table.mobile-records {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .mobile-records thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .mobile-records tbody {
    display: grid;
    gap: 12px;
  }
  .mobile-records tr {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    padding: 12px 14px;
  }
  .mobile-records td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border: 0 !important;
    padding: 6px 0 !important;
    background: transparent !important;
    text-align: left !important;
    font-size: 14px;
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 0;
    max-width: 100%;
  }
  .mobile-records td::before {
    content: attr(data-label);
    font-family: var(--f-ui);
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-3);
    flex-shrink: 0;
  }
  .mobile-cell-value {
    flex: 1;
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .mobile-cell-value .num,
  .mobile-cell-value .small {
    white-space: normal;
  }
  .mobile-records td.mobile-record-title {
    font-size: 17px;
    font-weight: 600;
    border-bottom: 1px solid var(--line) !important;
    padding-bottom: 12px !important;
    margin-bottom: 5px;
  }
  .mobile-records .mobile-record-detail {
    display: none;
  }
  .mobile-records .mobile-expanded .mobile-record-detail {
    display: flex;
  }
  .mobile-records .mobile-record-actions {
    display: flex;
    justify-content: flex-start;
    border-top: 1px solid var(--line) !important;
    margin-top: 10px;
    padding-top: 12px !important;
    gap: 8px;
  }
  .mobile-records .mobile-record-actions::before {
    display: none;
  }
  .mobile-records .mobile-record-actions .rowacts {
    display: contents;
  }
  .mobile-records .mobile-record-actions:empty {
    display: none;
  }
  .mobile-records .mobile-record-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .mobile-record-toggle {
    display: inline-flex;
  }
  .mobile-record-actions [data-act="nt-hd-xem"] {
    order: -2;
  }
  .mobile-record-actions [data-act="nt-hd-thu"] {
    order: -1;
  }
  .nt-workspace .nhac-o {
    padding: 12px;
    gap: 10px;
  }
  .nt-workspace .nhac-o .t {
    font-size: 14px;
  }
  .nt-workspace .hopdong-xem,
  .tenant-workspace .hopdong-xem {
    font-size: 16px;
    padding: 16px;
    max-height: none;
    line-height: 1.6;
  }
  .nt-workspace .post,
  .tenant-workspace .post {
    padding: 12px;
  }
  .nt-workspace .pb,
  .tenant-workspace .pb {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
@container (max-width:720px) {
  .top {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .top .tbtn {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }
  .top #btnDT,
  .top .who {
    display: none;
  }
  .main {
    padding: 14px 12px 24px;
    scroll-padding-bottom: 110px;
    overscroll-behavior-y: contain;
  }
  .tabbar {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .tabbar button {
    min-height: 48px;
  }
}
@media (max-width: 720px) {
  .modal-wrap {
    padding: 0;
    align-items: end;
  }
  .modal {
    border-radius: 18px 18px 0 0;
    padding: 18px 16px 0;
    max-height: min(94dvh, var(--visual-height, 94dvh));
    width: 100%;
    max-width: none;
    overscroll-behavior: contain;
    scroll-padding-top: 12px;
    scroll-padding-bottom: 100px;
  }
  .modal .frow {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .modal :is(input, select, textarea) {
    font-size: 16px;
    min-height: 48px;
    max-width: 100%;
  }
  .modal input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-height: 24px;
    flex-shrink: 0;
  }
  .modal .fld label {
    font-size: 14px;
  }
  .modal button.btn,
  .modal .iconbtn {
    min-height: 44px;
    min-width: 44px;
  }
  .modal .fld textarea {
    min-height: 130px;
  }
  .modal .acts {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding: 12px 0 max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    margin-top: 12px;
    z-index: 1;
  }
  .modal .acts .btn {
    flex: 1;
    min-height: 48px;
    justify-content: center;
  }
  .modal .hopdong-xem {
    padding: 14px;
    font-size: 16px;
    line-height: 1.6;
    max-height: none;
  }
  .auth {
    min-height: 100dvh;
    padding: 16px;
  }
  .auth input,
  .auth select,
  .auth textarea {
    font-size: 16px;
    min-height: 48px;
  }
  .auth .btn {
    min-height: 48px;
  }
  .toast {
    bottom: calc(82px + env(safe-area-inset-bottom));
    font-size: 14px;
    pointer-events: none;
  }
}
@media print {
  .nt-phone-nav,
  .nt-quick,
  .nt-meter-submit,
  .mobile-record-toggle {
    display: none !important;
  }
}
/* Keep the exit from desktop phone preview reachable. */
body.phone .top #btnDT {display:inline-flex}
