:root {
  --shell-sidebar-width: 220px;
  --shell-header-height: 50px;
  --shell-bg: #f2f2f2;
  --shell-sidebar-bg: #20222a;
  --shell-accent: #009688;
  --shell-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--shell-bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.shell-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--shell-header-height);
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  z-index: 1000;
  padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shell-header-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.shell-toggle {
  display: none;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-right: 8px;
  padding: 0;
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  background: #fff;
  color: #333;
  font-size: 18px;
  line-height: 34px;
  text-align: center;
  cursor: pointer;
}

.shell-brand {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-header-user {
  flex-shrink: 1;
  max-width: 42%;
  font-size: 13px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.shell-sidebar {
  position: fixed;
  top: var(--shell-header-height);
  left: 0;
  bottom: 0;
  width: var(--shell-sidebar-width);
  background: var(--shell-sidebar-bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1002;
  padding-bottom: var(--shell-safe-bottom);
}

.shell-sidebar .layui-nav {
  background: transparent;
  width: 100%;
  border-radius: 0;
}

.shell-sidebar .layui-nav .layui-nav-item {
  display: block;
  width: 100%;
  line-height: 48px;
}

.shell-sidebar .layui-nav .layui-nav-item a {
  color: rgba(255, 255, 255, 0.75);
  padding: 0 20px !important;
  height: 48px;
  line-height: 48px;
}

.shell-sidebar .layui-nav .layui-this a,
.shell-sidebar .layui-nav .layui-nav-item a:hover {
  color: #fff;
}

.shell-sidebar .layui-nav .layui-this {
  background: var(--shell-accent);
}

.shell-mask {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--shell-header-height);
  background: rgba(0, 0, 0, 0.45);
  z-index: 1001;
}

.shell-main {
  margin-left: var(--shell-sidebar-width);
  margin-top: var(--shell-header-height);
  min-height: calc(100vh - var(--shell-header-height));
  min-height: calc(100dvh - var(--shell-header-height));
  padding: 16px;
  padding-bottom: calc(16px + var(--shell-safe-bottom));
  box-sizing: border-box;
  overflow-x: hidden;
}

.shell-breadcrumb {
  margin-bottom: 12px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.shell-card {
  background: #fff;
  border-radius: 2px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 通用：防止内容撑破小屏 */
.shell-card img,
.shell-card table,
.shell-card .layui-table,
.shell-card .layui-table-view {
  max-width: 100%;
}

.shell-card .layui-fluid {
  padding: 0 !important;
}

.shell-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.shell-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.shell-toolbar .layui-inline,
.shell-toolbar .layui-input {
  margin: 0 !important;
}

.shell-toolbar .layui-input {
  width: 100%;
  min-width: 140px;
}

.account-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-copy-row .layui-input {
  flex: 1;
  width: auto;
}

.account-copy-row .account-copy {
  flex: none;
  margin: 0;
}

/* Layui 表单小屏：标签改为块级，避免挤在一行 */
@media (max-width: 768px) {
  .shell-toggle {
    display: inline-block;
  }

  .shell-sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  }

  .shell-sidebar.is-open {
    transform: translateX(0);
  }

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

  body.shell-nav-open .shell-mask {
    display: block;
  }

  .shell-main {
    margin-left: 0;
    padding: 12px;
    padding-bottom: calc(12px + var(--shell-safe-bottom));
  }

  .shell-card {
    padding: 12px;
  }

  .shell-header-user {
    max-width: 36%;
    font-size: 12px;
  }

  .shell-card .layui-form-label {
    float: none !important;
    display: block;
    width: auto !important;
    padding: 0 0 6px !important;
    text-align: left !important;
    line-height: 1.4 !important;
  }

  .shell-card .layui-input-block,
  .shell-card .layui-input-inline {
    margin-left: 0 !important;
    left: 0 !important;
    width: 100% !important;
    min-height: auto;
  }

  .shell-card .layui-form-item .layui-inline {
    display: block;
    margin-right: 0;
    margin-bottom: 10px;
  }

  .shell-card .layui-form-pane .layui-form-label {
    width: 100% !important;
    border-right: none;
    border-radius: 2px 2px 0 0;
  }

  .shell-card .layui-form-pane .layui-input-block,
  .shell-card .layui-form-pane .layui-input-inline {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .shell-card .layui-btn,
  .shell-card .layui-btn-fluid {
    margin-bottom: 8px;
  }

  .shell-card .layui-btn-container .layui-btn {
    margin: 0 8px 8px 0;
  }

  .shell-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .shell-toolbar .layui-btn {
    width: 100%;
    margin: 0;
  }

  .shell-toolbar .layui-inline {
    width: 100%;
  }

  /* layer 弹层在手机上尽量全宽 */
  .layui-layer {
    max-width: calc(100vw - 24px) !important;
  }

  .layui-layer-page .layui-layer-content {
    overflow-x: hidden !important;
  }

  blockquote.layui-elem-quote {
    padding: 10px 12px;
    font-size: 14px;
  }
}

/* 认证页 */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1aa094 0%, #0d7377 45%, #212121 100%);
  padding: 24px 16px;
  padding-bottom: calc(24px + var(--shell-safe-bottom));
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 4px;
  padding: 28px 24px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  text-align: center;
}

.auth-card .auth-sub {
  text-align: center;
  color: #888;
  margin-bottom: 20px;
  font-size: 13px;
}

.auth-card .layui-form-item {
  margin-bottom: 14px;
}

.auth-actions {
  margin-top: 8px;
}

.auth-links {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
}

.auth-links a {
  color: var(--shell-accent);
  margin: 0 6px;
  display: inline-block;
  padding: 4px 0;
}

.auth-errors {
  margin-top: 12px;
  color: #ff5722;
  font-size: 13px;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 22px 16px 16px;
  }

  .auth-card h1 {
    font-size: 20px;
  }
}

/* 移动友好列表（就诊人/会员卡等） */
.h5-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.h5-list-item {
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fafafa;
  padding: 12px;
}

.h5-list-main {
  display: block;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-all;
}

.h5-list-main:active {
  color: var(--shell-accent);
}

.h5-list-meta {
  margin-top: 6px;
  color: #888;
  font-size: 12px;
  line-height: 1.4;
}

.h5-list-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.h5-list-actions .layui-btn {
  margin: 0;
}

.food-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.food-chip-wrap .layui-btn {
  margin: 0 !important;
}
