/* FE/v3/styles-compact.css */

/* =========================
   Hermes v3 Compact Layout
   iPhone SE / small-screen overrides
========================= */

@media (max-width: 390px), (max-height: 700px) {
  /* -------------------------
     Global compact rhythm
  ------------------------- */

  .v3-screen {
    font-size: 12px;
  }

  button {
    -webkit-tap-highlight-color: transparent;
  }

  /* -------------------------
     Lobby
  ------------------------- */

  .v3-home-screen {
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
  }

  .v3-home-bottom-panel--simple {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    width: 100%;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    place-items: center;
    padding: 6px;
    transform: none;
  }

  .v3-home-bottom-panel--simple .v3-home-primary-button {
    width: min(100%, 300px);
    min-height: 34px;
    padding: 0 14px;
    font-size: 0.76rem;
    line-height: 1.2;
    border-radius: 18px;
  }

  .v3-home-nameplate {
    margin-bottom: 6px;
    font-size: 12px;
  }

  .v3-home-bubble-text {
    font-size: 14px;
  }


  /* -------------------------
     Place Header
     Lobby / Room / Settings compatible header tuning
  ------------------------- */

  .v3-place-header {
    padding: 6px;
  }

  .v3-place-header__side {
    min-height: 34px;
  }

  .v3-place-header__button {
    min-height: 32px;
    padding: 0 9px;
    font-size: 0.72rem;
  }

  .v3-place-header__center {
    gap: 2px;
  }

  .v3-place-header__eyebrow {
    margin: 0;
    font-size: 0.58rem;
    letter-spacing: 0.10em;
  }

  .v3-place-header__title {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.2;
  }

  .v3-place-header__description {
    max-width: 28ch;
    margin: 0;
    font-size: 0.68rem;
    line-height: 1.35;
  }


  /* -------------------------
     Room shell / tabs
  ------------------------- */

  .v3-room-shell {
    padding: 6px;
  }

  .v3-room-shell__body {
    min-height: 0;
    margin-top: 6px;
  }

  .v3-room-segment__button {
    min-height: 28px;
    font-size: 0.78rem;
  }

  /* -------------------------
     Current consultation
  ------------------------- */

  .v3-current-consultation {
    min-height: 0;
  }

  .v3-current-consultation__header {
    gap: 8px;
    padding: 10px;
    flex-direction: row;
  }

  .v3-current-consultation__title-block {
    min-width: 0;
  }

  .v3-current-consultation__folder-name {
    max-width: 100%;
    margin-bottom: 5px;
    padding: 3px 8px;
    font-size: 0.66rem;
  }

  .v3-current-consultation__title {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .v3-current-consultation__meta {
    gap: 6px;
    margin-top: 4px;
    font-size: 0.66rem;
    line-height: 1.25;
  }

  .v3-current-consultation__body {
    min-height: 0;
  }

  .v3-current-consultation__input {
    padding-top: 6px;
  }

  .v3-current-consultation__action-button,
  .v3-action-menu__trigger {
    min-width: 32px;
    min-height: 32px;
  }

  /* -------------------------
     Message list
  ------------------------- */

  .v3-message-list {
    gap: 7px;
    padding: 8px;
  }

  .v3-message {
    max-width: 94%;
  }

  .v3-message__body {
    padding: 8px 10px;
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .v3-message__meta {
    margin-top: 3px;
    font-size: 0.62rem;
    line-height: 1.2;
  }

  .v3-message--assistant .v3-message__body,
  .v3-message--user .v3-message__body {
    border-radius: 14px;
  }

  /* -------------------------
     Message input
  ------------------------- */

  .v3-message-input {
    gap: 6px;
    padding: 6px;
  }

  .v3-message-input__options {
    gap: 6px;
    min-height: 0;
  }

  .v3-message-input__textarea {
    min-height: 38px;
    padding: 9px 10px;
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .v3-message-input__send-button {
    min-width: 54px;
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .v3-message-input-bar__network-toggle {
    min-height: 34px;
    padding: 0 10px;
    gap: 6px;
    font-size: 0.76rem;
  }

  .v3-message-input-bar__network-dot {
    width: 7px;
    height: 7px;
  }

  .v3-message-input-bar__network-label {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  /* -------------------------
     History / folder list
  ------------------------- */

  .v3-consultation-history,
  .v3-folder-list-view,
  .v3-folder-consultation-list {
    min-height: 0;
  }

  .v3-consultation-history__header,
  .v3-folder-list-view__header {
    gap: 5px;
    padding: 10px;
  }

  .v3-consultation-history__title,
  .v3-folder-list-view__title {
    margin: 0;
    font-size: 14px;
    line-height: 1.25;
  }

  .v3-consultation-history__description,
  .v3-folder-list-view__description {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.4;
  }

  .v3-folder-list-view__list {
    gap: 8px;
    padding: 8px;
  }

  .v3-folder-item__title {
    font-size: 14px;
  }

  .v3-folder-item__info {
    display: flex;
  }

  .v3-folder-item__active-badge {
    margin-left: 20px;
    align-self: flex-start;
  }

  .v3-folder-item__main {
    padding: 6px 50px 6px 6px;
  }

  .v3-folder-card {
    min-height: 0;
    padding: 10px;
  }

  .v3-folder-card__body {
    gap: 4px;
    min-width: 0;
  }

  .v3-folder-card__title {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 0.9rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .v3-folder-card__description,
  .v3-folder-card__meta {
    font-size: 0.68rem;
    line-height: 1.35;
  }

  .v3-folder-card__status {
    font-size: 0.64rem;
  }

  /* -------------------------
     Folder consultation list
  ------------------------- */

  .v3-folder-consultation-list__header {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 6px;
    padding: 9px;
  }

  .v3-folder-consultation-list__back-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .v3-folder-consultation-list__back-button::before {
    content: "←";
    font-size: 0.9rem;
  }

  .v3-folder-consultation-list__title-block {
    gap: 3px;
    min-width: 0;
  }

  .v3-folder-consultation-list__title {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .v3-folder-consultation-list__meta {
    gap: 5px;
    font-size: 0.62rem;
  }

  .v3-folder-consultation-list__description {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 0.66rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .v3-folder-consultation-list__summary {
    gap: 12px;
    padding: 6px;
    font-size: 0.78rem;
  }

  .v3-folder-consultation-list__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    padding: 6px;
    overflow-y: auto;
  }

  /* -------------------------
     Consultation cards
  ------------------------- */

  .v3-consultation-card {
    flex: 0 0 auto;
    min-height: 76px;
  }

  .v3-consultation-card__main {
    gap: 6px;
    min-width: 0;
  }

  .v3-consultation-card__title {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .v3-consultation-card__info {
    display: flex;
    justify-content: space-between;
  }

  .v3-consultation-card__summary {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 0.72rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .v3-consultation-card__meta {
    margin: 0;
    gap: 6px;
    font-size: 0.66rem;
    line-height: 1.3;
  }

  .v3-consultation-card__badge,
  .v3-status-badge {
    padding: 2px 7px;
    font-size: 0.62rem;
  }

  .v3-consultation-card__action-menu,
  .v3-folder-card__action-menu {
    top: 8px;
    right: 8px;
  }

  /* -------------------------
     Add card
  ------------------------- */

  .v3-add-card {
    min-height: 0;
    padding: 10px;
  }

  .v3-add-card__icon {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .v3-add-card__title {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .v3-add-card__description {
    margin: 3px 0 0;
    font-size: 0.68rem;
    line-height: 1.35;
  }

  /* -------------------------
     Action menu / dialogs
  ------------------------- */

  .v3-action-menu {
    min-width: 148px;
    padding: 5px;
  }

  .v3-action-menu__item {
    min-height: 32px;
    padding: 0 9px;
    font-size: 0.76rem;
  }

  .v3-dialog {
    width: min(94vw, 340px);
    max-height: min(86dvh, 620px);
    padding: 14px;
  }

  .v3-dialog__title {
    font-size: 1rem;
    line-height: 1.3;
  }

  .v3-dialog__description {
    font-size: 0.72rem;
    line-height: 1.45;
  }

  .v3-dialog__body {
    gap: 10px;
  }

  .v3-dialog__actions {
    gap: 8px;
  }

  .v3-dialog__cancel-button,
  .v3-dialog__confirm-button,
  .v3-dialog__danger-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .v3-create-dialog__input,
  .v3-rename-dialog__input {
    min-height: 38px;
    padding: 0 11px;
    font-size: 0.84rem;
  }

  .v3-target-preview-card {
    padding: 9px;
  }

  .v3-target-preview-card__label {
    font-size: 0.62rem;
  }

  .v3-target-preview-card__title {
    font-size: 0.82rem;
  }

  .v3-target-preview-card__meta {
    font-size: 0.66rem;
  }

  .v3-warning-block {
    padding: 9px;
  }

  .v3-warning-block__title {
    font-size: 0.76rem;
  }

  .v3-warning-block__message {
    font-size: 0.68rem;
    line-height: 1.4;
  }

  /* -------------------------
     Settings screen
  ------------------------- */

  .v3-settings-screen {
    gap: 8px;
    padding: 10px;
  }

  .v3-settings-hero {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    min-height: 0;
    padding: 4px;
  }

  .v3-settings-hero__side {
    min-height: 28px;
  }

  .v3-settings-hero__center {
    gap: 3px;
  }

  .v3-settings-hero__eyebrow {
    font-size: 0.58rem;
    letter-spacing: 0.10em;
  }

  .v3-settings-hero__title {
    font-size: 14px;
    line-height: 1.25;
  }

  .v3-settings-hero__description {
    font-size: 10px;
    line-height: 1.35;
  }

  .v3-settings-section {
    padding: 10px;
  }

  .v3-settings-section__header {
    gap: 3px;
  }

  .v3-settings-section__label {
    margin-bottom: 4px;
    font-size: 0.58rem;
  }

  .v3-settings-section__title {
    font-size: 14px;
    line-height: 1.25;
  }

  .v3-settings-section__description {
    margin-top: 5px;
    font-size: 10px;
    line-height: 1.4;
  }

  .v3-settings-placeholder {
    margin-top: 8px;
    padding: 9px;
    font-size: 10px;
    line-height: 1.45;
  }

  .v3-settings-dev-grid {
    gap: 6px;
    margin-top: 8px;
  }

  .v3-settings-item {
    gap: 7px;
    padding: 8px;
  }

  .v3-settings-item__label {
    font-size: 0.76rem;
  }

  .v3-settings-item__description {
    font-size: 0.66rem;
  }

  .v3-settings-item__value {
    padding: 4px 7px;
    font-size: 0.64rem;
  }

  .v3-settings-footer {
    gap: 8px;
  }

  .v3-settings-screen__nav-button {
    min-height: 38px;
    font-size: 0.82rem;
  }
}