:root {
  --ui-control: 40px;
  --ui-touch: 44px;
  --ui-radius: 6px;
  --ui-focus: rgba(30, 103, 214, 0.24);
  --ui-elevated: 0 5px 14px rgba(19, 42, 54, 0.1);
}

button, a, input, select {
  -webkit-tap-highlight-color: transparent;
}

button, .icon-button, .primary-button, .secondary-button, .danger-button, .tool-button,
.tab-button, .section-nav a, .page-trip .tab-bar a, select, input {
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease,
    box-shadow 160ms ease, transform 160ms ease, opacity 160ms ease;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 2px;
}

.icon-button {
  width: var(--ui-control);
  height: var(--ui-control);
  min-width: var(--ui-control);
  min-height: var(--ui-control);
  flex: 0 0 var(--ui-control);
  position: relative;
  border-radius: var(--ui-radius);
}

.icon-button:hover, .tool-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--ui-elevated);
}

.icon-button:active, .tool-button:active,
.primary-button:active, .secondary-button:active, .danger-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.primary-button, .secondary-button, .danger-button {
  min-height: var(--ui-control);
  padding: 0 14px;
  border-radius: var(--ui-radius);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  box-shadow: 0 4px 12px rgba(22, 122, 91, 0.16);
}

.primary-button:hover, .secondary-button:hover, .danger-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--ui-elevated);
}

.primary-button svg, .secondary-button svg, .danger-button svg, .tool-button svg {
  flex: 0 0 auto;
}

button:disabled, [aria-disabled="true"] {
  transform: none !important;
  box-shadow: none !important;
}

select, input {
  min-height: 38px;
  border-radius: var(--ui-radius);
}

select:hover, input:hover {
  border-color: #9eafb8;
}

.segmented {
  padding: 3px;
  gap: 3px;
  border: 1px solid #cbd5da;
  border-radius: var(--ui-radius);
  background: #edf2f4;
  overflow: visible;
}

.segmented button {
  min-height: 32px;
  border: 0 !important;
  border-radius: 4px;
  background: transparent;
}

.segmented button:hover:not(.active) {
  background: #fff;
  color: #263943;
}

.segmented button.active {
  box-shadow: 0 2px 7px rgba(14, 46, 60, 0.18);
}

.room-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 6px 4px;
  border-radius: 4px;
}

.room-link:hover {
  background: #edf6f8;
}

.compact-toggle {
  min-height: 34px;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.compact-toggle input {
  width: 34px !important;
  height: 20px !important;
  min-height: 20px;
  margin: 0;
  padding: 0;
  appearance: none;
  position: relative;
  flex: 0 0 34px;
  border: 1px solid #aebbc2;
  border-radius: 10px;
  background: #dfe5e8;
  cursor: pointer;
}

.compact-toggle input::after {
  content: "";
  width: 14px;
  height: 14px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(18, 37, 46, 0.28);
  transition: transform 160ms ease;
}

.compact-toggle input:checked {
  border-color: #167a5b;
  background: #167a5b;
}

.compact-toggle input:checked::after {
  transform: translateX(14px);
}

.section-nav {
  min-height: 50px;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar, .page-control .tab-bar::-webkit-scrollbar,
.page-trip .tab-bar::-webkit-scrollbar, .header-status::-webkit-scrollbar {
  display: none;
}

.section-nav a {
  min-height: 38px;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-bottom-color: transparent;
  border-radius: var(--ui-radius);
  white-space: nowrap;
}

.section-nav a svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.section-nav a:hover {
  background: #f3f6f7;
}

.section-nav a.active {
  border-color: #c6dbe4;
  background: #edf6f8;
}

.page-control .app-header {
  overflow: visible;
}

.page-control .header-actions {
  padding: 4px;
  gap: 4px;
  border: 1px solid rgba(202, 214, 220, 0.82);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 3px 11px rgba(24, 45, 55, 0.06);
}

.page-control .header-actions .icon-button {
  border-color: transparent;
}

.page-control .header-actions .icon-secondary {
  color: #176f89;
  background: #e9f5f7;
}

.page-control .header-actions .icon-primary {
  color: #fff;
  background: #167a5b;
  border-color: #167a5b;
  box-shadow: 0 4px 12px rgba(22, 122, 91, 0.18);
}

.page-control .header-actions .icon-primary:hover {
  background: #11684d;
}

.page-control .header-status {
  max-width: min(680px, 48vw);
  overflow-x: auto;
  scrollbar-width: none;
}

.page-control .status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(26, 57, 72, 0.06);
}

.page-control .tab-bar {
  height: 54px;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.page-control .tab-button {
  min-width: 108px;
  flex: 1 0 auto;
  position: relative;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  white-space: nowrap;
}

.page-control .tab-button:hover {
  background: #f4f7f8;
}

.page-control .tab-button.active {
  border-color: #c9ded7;
  border-bottom-color: #167a5b;
  background: #edf6f2;
}

.page-control .tab-count {
  min-width: 19px;
  min-height: 19px;
  font-size: 10px;
}

.page-analytics .app-header .icon-button,
.page-forecast .app-header .icon-button,
.page-trip .app-header .icon-button {
  background: rgba(255, 255, 255, 0.06);
}

.page-analytics .app-header .icon-button:hover,
.page-forecast .app-header .icon-button:hover,
.page-trip .app-header .icon-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.page-trip .tab-bar {
  min-height: 50px;
  height: 50px;
  gap: 6px;
  scrollbar-width: none;
}

.page-trip .tab-bar a {
  min-width: 118px;
  min-height: 38px;
  align-self: center;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
}

.page-trip .tab-bar a:hover {
  background: #f3f6f7;
}

.page-trip .tab-bar a.active {
  border-color: #c6dbe4;
  background: #edf6f8;
}

.page-trip .tool-button {
  min-width: var(--ui-control);
  min-height: var(--ui-control);
  border-radius: var(--ui-radius);
}

.page-trip .key-grid button {
  min-height: 38px;
  border-radius: var(--ui-radius);
}

.page-trip .key-grid button:hover {
  border-color: #9eafb8;
  background: #fff;
  color: #263943;
}

.page-login .login-shell {
  background-color: #eef3f4;
  background-image: url("/assets/revenue-flow-v1.png");
  background-position: center;
  background-size: cover;
  background-blend-mode: screen;
}

.page-login .login-form button {
  border-radius: var(--ui-radius);
  box-shadow: 0 5px 16px rgba(8, 122, 131, 0.18);
}

.page-login .input-wrap {
  border-radius: var(--ui-radius);
}

dialog {
  border: 1px solid #d6dfe3;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(17, 34, 43, 0.24);
}

dialog::backdrop {
  background: rgba(18, 31, 38, 0.46);
}

@media (hover: hover) and (pointer: fine) {
  .icon-button[aria-label]::after, .tool-button[aria-label]::after {
    content: attr(aria-label);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 120;
    padding: 6px 8px;
    border-radius: 4px;
    color: #fff;
    background: #182b34;
    box-shadow: 0 5px 14px rgba(12, 25, 32, 0.2);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -3px);
    transition: opacity 140ms ease, transform 140ms ease;
  }

  .icon-button[aria-label]:hover::after, .icon-button[aria-label]:focus-visible::after,
  .tool-button[aria-label]:hover::after, .tool-button[aria-label]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  .brand-block > .icon-button[aria-label]::after {
    left: 0;
    transform: translate(0, -3px);
  }

  .brand-block > .icon-button[aria-label]:hover::after,
  .brand-block > .icon-button[aria-label]:focus-visible::after {
    transform: translate(0, 0);
  }
}

@media (max-width: 720px) {
  :root { --ui-control: var(--ui-touch); }

  .page-control .app-header {
    min-height: 112px;
    padding: 9px 11px 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .page-control .app-header::after {
    opacity: 0.16;
  }

  .page-control .brand-block {
    gap: 9px;
    min-width: 0;
  }

  .page-control .brand-mark {
    width: 40px;
    height: 40px;
  }

  .page-control .brand-block > div:last-child {
    min-width: 0;
  }

  .page-control h1 {
    max-width: none;
    overflow: visible;
    font-size: 14px;
    line-height: 1.25;
    text-overflow: clip;
    white-space: normal;
  }

  .page-control h1 .mobile-title-line {
    display: block;
  }

  .page-control .brand-block p {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-control .header-actions {
    padding: 3px;
  }

  .page-control .header-actions .icon-button {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    flex-basis: 38px;
  }

  .page-control .header-status {
    width: 100%;
    max-width: none;
    padding: 2px 0;
    gap: 6px;
    overflow: hidden;
  }

  .page-control .header-status .status-pill:nth-child(n + 4) {
    display: none;
  }

  .future3-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .future3-total {
    line-height: 1.45;
  }

  .future3-total b {
    margin-left: 3px;
    font-size: 16px;
  }

  .date-table {
    display: block;
    min-width: 0;
  }

  .date-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .date-table tbody {
    display: grid;
    gap: 10px;
  }

  .date-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
  }

  .date-table td {
    display: flex;
    min-width: 0;
    min-height: 60px;
    padding: 10px 12px;
    flex-direction: column;
    justify-content: center;
    border: 0;
    border-top: 1px solid #edf0f2;
  }

  .date-table td:nth-child(even) {
    border-right: 1px solid #edf0f2;
  }

  .date-table td:first-child,
  .date-table td:nth-child(6),
  .date-table td:last-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .date-table td:first-child {
    min-height: 50px;
    border-top: 0;
    background: var(--surface-soft);
  }

  .date-table td:last-child {
    min-height: 56px;
  }

  .date-table td:nth-child(n + 2)::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
  }

  .date-table td:nth-child(2)::before { content: "已售 / 满房"; }
  .date-table td:nth-child(3)::before { content: "剩余"; }
  .date-table td:nth-child(4)::before { content: "净ADR"; }
  .date-table td:nth-child(5)::before { content: "净RevPAR"; }
  .date-table td:nth-child(6)::before { content: "24h新单"; }
  .date-table td:nth-child(7)::before { content: "当前决策"; }

  .date-table .progress-track {
    width: 100%;
  }

  .date-table .decision-pill {
    align-self: flex-start;
  }

  .page-control .tab-bar {
    height: 62px;
    padding: 4px 8px;
    align-items: center;
    scroll-snap-type: x proximity;
  }

  .page-control .tab-button {
    min-width: 72px;
    height: 52px;
    flex: 0 0 72px;
    flex-direction: column;
    gap: 3px;
    padding: 4px 5px;
    scroll-snap-align: start;
  }

  .page-control .tab-button svg {
    width: 17px;
    height: 17px;
  }

  .page-control .tab-button span:not(.tab-count) {
    display: block;
    max-width: 66px;
    overflow: hidden;
    color: inherit;
    font-size: 9px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-control .tab-count {
    position: absolute;
    top: 3px;
    right: 5px;
  }

  .section-nav {
    min-height: 60px;
    padding: 4px 8px;
    scroll-snap-type: x proximity;
  }

  .section-nav a {
    min-width: 82px;
    min-height: 50px;
    flex: 0 0 82px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 4px 6px;
    font-size: 9px;
    scroll-snap-align: start;
  }

  .section-nav a svg {
    width: 17px;
    height: 17px;
  }

  .page-trip .tab-bar {
    min-height: 60px;
    height: 60px;
    padding: 4px 8px;
    scroll-snap-type: x proximity;
  }

  .page-trip .tab-bar a {
    min-width: 82px;
    min-height: 50px;
    flex: 0 0 82px;
    flex-direction: column;
    gap: 3px;
    padding: 4px 6px;
    font-size: 9px;
    scroll-snap-align: start;
  }

  .page-trip .tab-bar a span {
    display: block;
  }

  .page-trip .tab-bar a svg {
    width: 17px;
    height: 17px;
  }

  .button-row > button, .dialog-actions > button {
    min-height: var(--ui-touch);
  }

  .segmented button, .room-link {
    min-height: 40px;
  }

  .button-row > button {
    flex: 1 1 128px;
  }

  .compact-toggle {
    min-height: var(--ui-touch);
  }

  .toast {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  button, .icon-button, .primary-button, .secondary-button, .danger-button, .tool-button,
  .tab-button, .section-nav a, select, input, .compact-toggle input::after {
    transition-duration: 1ms !important;
  }
}

/* The owner-facing console now opens directly; login/logout controls are intentionally hidden. */
[data-action="logout"],
#logout,
#logout-button {
  display: none !important;
}

.public-quote-entry {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.public-quote-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.public-quote-fields label { min-width: 0; display: grid; gap: 6px; }
.public-quote-fields label > span { color: var(--muted); font-size: 11px; }
.public-quote-fields input, .public-quote-fields select {
  width: 100%; min-width: 0; padding: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.public-quote-confirm { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; font-size: 12px; line-height: 1.6; }
.public-quote-confirm input { flex: 0 0 18px; width: 18px; min-height: 18px; margin: 1px 0; }
.public-quote-entry .button-row { margin-top: 14px; }
.public-quote-entry .muted { font-size: 11px; }
.ai-action-title h3, .ai-action-row p, .ai-action-row small, .ai-action-row strong,
.proposal-copy, .scope-line, .execution-summary h3 { overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .page-control .header-status { flex-wrap: wrap; overflow: visible; }
  .page-control .header-status .status-pill:nth-child(n + 4) { display: inline-flex; }
  .page-control .header-status .status-pill { max-width: 100%; white-space: normal; }
  .page-control .header-status .status-data { order: -1; }
  .page-control .app-header { position: relative; }
  .page-control .tab-bar { position: sticky; top: 0; z-index: 20; }
  .page-control .page-heading { flex-wrap: wrap; gap: 12px; }
  .page-control .page-heading > div { min-width: 0; }
  .ai-action-title { flex-direction: column; gap: 6px; }
  .ai-workspace > *, .workspace-grid > *, .approval-layout > *, .audit-grid > * { min-width: 0; }
  .public-quote-fields { grid-template-columns: 1fr; }
  .public-quote-fields input, .public-quote-fields select { font-size: 16px; min-height: 44px; }
  .public-quote-confirm { padding: 6px 0; }
  dialog { max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 16px; }
  .dialog-header, .dialog-actions { gap: 10px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions > button { white-space: normal; height: auto; padding-top: 10px; padding-bottom: 10px; }
}
