:root{font-family:Inter,"Segoe UI","Microsoft YaHei",sans-serif;color:#152b40}*{box-sizing:border-box}.login-page{margin:0;min-height:100dvh;display:grid;place-items:center;background:radial-gradient(ellipse at top left,#d9f1ee,transparent 65%),#edf2f8;padding:24px}.login-card{width:min(100%,450px);padding:44px 36px;background:white;border:1px solid #dbe3ed;border-radius:22px;box-shadow:0 24px 70px #173b5e14}.login-eyebrow{font-size:12px;letter-spacing:.16em;color:#18796e;font-weight:700}.login-card h1{font-size:32px;letter-spacing:-1px;margin:16px 0 8px}.login-subtitle{color:#62758b;margin:0 0 32px}.login-card label{display:block;font-size:16px;font-weight:600;margin:20px 0 8px}.login-card input{width:100%;font:inherit;border:1px solid #bac9d8;border-radius:9px;padding:13px}.login-card button{width:100%;margin-top:28px;background:#126d63;color:white;border:0;border-radius:9px;padding:14px;font:inherit;font-weight:600;cursor:pointer}.login-card button:disabled{opacity:.6}.login-card input:focus-visible,.login-card button:focus-visible{outline:3px solid #61b8ae;outline-offset:3px}#loginMessage{min-height:24px;color:#a93030;font-size:14px}.login-footnote{font-size:14px;color:#64768a;text-align:center}.cloud-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px 18px;background:#edf7f5;border:1px solid #c4e2dc;border-radius:12px;margin-bottom:18px;font-size:14px}.cloud-toolbar span{flex:1}.cloud-toolbar button{font:inherit;padding:7px 12px;cursor:pointer;border:1px solid #b9d6d0;border-radius:7px;background:white;color:#174b44}.cloud-toolbar[data-error="true"]{background:#fff2e9;border-color:#e4b799}.cloud-toolbar a{color:#164e73}body.cloud-loading .app{visibility:hidden}#cloudStartup{padding:40px;font:16px system-ui}@media(max-width:640px){.login-card{padding:30px 24px}.top,.actions,.property-inline,.button-row{flex-wrap:wrap}.top{gap:16px}.app{padding:16px!important}.filters-grid{grid-template-columns:1fr!important}.table-wrap{overflow-x:auto}.cloud-toolbar{align-items:flex-start}.cloud-toolbar span{flex-basis:100%}dialog{max-width:calc(100vw - 24px)!important}.rooms{grid-template-columns:1fr!important}}

/* Keep narrow layouts in normal document flow. Desktop places filters beside
   the tabs with negative margins, and its three-column metrics cannot fit a phone. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
#ledgerDialog { width: min(1120px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
#ledgerDialog h3 { margin: 24px 0 14px; font-size: 18px; }
.ledger-select-label { display: grid; gap: 8px; margin: 18px 0; font-size: 16px; }
.ledger-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ledger-summary > div { padding: 18px; background: #f5f7f7; border: 1px solid #e0e5e5; border-radius: 10px; }
.ledger-summary span { display: block; color: #59666d; font-size: 14px; }
.ledger-summary strong { display: block; margin-top: 12px; font-size: 22px; overflow-wrap: anywhere; }
.ledger-warning { white-space: pre-line; background: #fff7e9; border: 1px solid #eadab7; padding: 14px; margin: 16px 0; border-radius: 8px; font-size: 14px; line-height: 1.7; }
.ledger-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.ledger-controls button { min-height: 44px; }
.ledger-record { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding: 18px 0; border-bottom: 1px solid #e3e7e8; }
.ledger-record > div { min-width: 0; }
.ledger-record p { font-size: 14px; color: #5b6870; line-height: 1.7; overflow-wrap: anywhere; }
#ledgerEditor { padding: 18px; background: #f4f8f7; border: 1px solid #dce6e3; border-radius: 12px; margin: 16px 0; }
#ledgerDialog [hidden] { display: none !important; }
#ledgerMessage { line-height: 1.7; font-size: 15px; }
.ledger-audit { margin-top: 24px; font-size: 14px; }
.ledger-audit pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#ledgerDialog .table-wrap { overflow-x: auto; }
#ledgerDialog table { min-width: 760px; }
@media (max-width: 760px) {
  .actions #ledgerLauncher { grid-column: 1 / -1; }
  .ledger-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ledger-summary > div { padding: 12px; }
  .ledger-summary strong { font-size: 18px; }
  .ledger-record { flex-direction: column; gap: 4px; }
  .ledger-controls > button { flex: 1 1 140px; }
  #ledgerEditor { padding: 12px; }
  #ledgerDialog select, #ledgerDialog input, #ledgerDialog textarea { font-size: 16px; }
}
#depositDialog { width: 620px; max-width: calc(100vw - 24px); }
.deposit-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 12px; font-size: 16px; line-height: 1.5; }
.deposit-confirm input { width: 20px; min-width: 20px; height: 20px; margin-top: 2px; }
#depositError { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.deposit-history { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.deposit-history h3 { font-size: 16px; }
.deposit-history-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.deposit-history-row span { flex: 1 1 200px; font-size: 14px; overflow-wrap: anywhere; }
.deposit-history-row button { min-height: 44px; }
@media (max-width: 980px) {
  #rooms .section-head {
    height: auto;
    min-height: 0;
    margin: 0 0 12px;
    padding: 0;
    pointer-events: auto;
  }
  #rooms .section-head .button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 10px;
  }
  #rooms .section-head select { width: 100%; min-width: 0; }
  #pageTabs { width: 100%; max-width: 100%; }
}

@media (max-width: 760px) {
  .app {
    width: calc(100% - 24px);
    max-width: 100%;
    padding: 16px 0 32px !important;
  }
  .app > *, .top > *, .property-inline > *, .page > * { min-width: 0; }
  .top { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 16px; padding: 0 0 18px; }
  h1, #appTitle { font-size: 25px; line-height: 1.35; overflow-wrap: anywhere; }
  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .actions .ghost { width: 100%; min-width: 0; min-height: 44px; height: auto; padding: 10px 8px; font-size: 14px; }
  .actions #exportCsv { grid-column: 1 / -1; }

  .app .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary .metric, .summary .summary-card:nth-child(6) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    height: auto;
    min-height: 160px;
    padding: 14px;
    gap: 10px;
    overflow: visible;
  }
  .summary .metric-icon, .summary-card:nth-child(6) .metric-icon {
    width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px;
  }
  .summary .metric-icon svg, .summary-card:nth-child(6) .metric-icon svg { width: 22px; height: 22px; }
  .summary .metric-copy, .summary-card:nth-child(6) .metric-copy {
    width: 100%; max-width: 100%; min-width: 0; overflow: visible; gap: 6px;
  }
  .summary .metric-copy span { font-size: 14px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
  .summary .metric strong, .summary-card:nth-child(6) strong {
    font-size: 24px; line-height: 1.2; letter-spacing: -.035em;
    white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip;
  }

  .property-bar { height: auto; min-height: 0; padding: 14px; }
  .property-inline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .property-bar label { grid-column: 1 / -1; width: auto; margin: 0; font-size: 14px; }
  .property-bar select { grid-column: 1 / -1; width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
  .property-bar button.secondary, .property-bar button.ghost, .property-bar button.danger {
    width: 100%; min-width: 0; min-height: 44px; height: auto; padding: 10px 4px; gap: 5px; font-size: 14px;
  }
  .property-bar button::before { flex-shrink: 0; }
  #pageTabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: auto; margin: 16px 0; }
  #pageTabs .tab { width: 100%; min-width: 0; height: auto; min-height: 46px; padding: 10px 5px; font-size: 16px; white-space: normal; }
  #rooms .section-head { margin-top: 0; margin-bottom: 0; }
  #rooms .section-head select { min-height: 44px; font-size: 16px; }
  .app .rooms { grid-template-columns: minmax(0, 1fr) !important; }
  .room { height: auto; padding: 16px; }
  .room:hover { transform: none; }
  .tenant-line { grid-template-columns: minmax(0, 1fr) auto; }
  .room-card-head h3 { overflow-wrap: anywhere; }
  .page-toolbar { align-items: stretch; }
  .filters-grid { width: 100%; grid-template-columns: minmax(0, 1fr) !important; }
  .summary-inline { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
  .cloud-toolbar { margin: 12px; padding: 12px; gap: 8px; }
  .cloud-toolbar span { flex-basis: 100%; line-height: 1.5; overflow-wrap: anywhere; }
  .cloud-toolbar button { min-height: 44px; flex: 1 1 calc(50% - 8px); }
  dialog { width: calc(100% - 24px); max-width: calc(100% - 24px) !important; max-height: calc(100dvh - 32px); padding: 16px; overflow: auto; }
  dialog input, dialog select, dialog textarea { max-width: 100%; min-width: 0; font-size: 16px; }
  .fields, .facts { grid-template-columns: minmax(0, 1fr); }
  .dialog-head h2 { min-width: 0; overflow-wrap: anywhere; }
}
