/* ============================================
   内部导航工作台 前端样式
   移动端优先设计
   ============================================ */

:root {
    --primary: #4A90D9;
    --primary-dark: #357ABD;
    --primary-light: #E8F2FC;
    --success: #52C41A;
    --warning: #FAAD14;
    --danger: #FF4D4F;
    --info: #1890FF;
    --text-main: #333333;
    --text-secondary: #666666;
    --text-hint: #999999;
    --bg-page: #F5F6FA;
    --bg-card: #FFFFFF;
    --border: #EBEBEB;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-active: 0 4px 20px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 15px;
    color: var(--text-main);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}

input, textarea, button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
}

a { text-decoration: none; color: inherit; }

/* ==================== Toast ==================== */
#toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: rgba(0,0,0,0.78);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 280px;
    text-align: center;
    line-height: 1.5;
    animation: toastIn 0.3s ease;
    word-break: break-all;
}

@keyframes toastIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

/* ==================== 登录页 ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    background: linear-gradient(160deg, #4A90D9 0%, #357ABD 55%, #2B6499 100%);
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.login-logo svg { width: 38px; height: 38px; }

.login-title {
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 2px;
}

.login-subtitle {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    margin: 6px 0 26px;
    letter-spacing: 4px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px 22px 20px;
    box-shadow: var(--shadow-active);
}

.login-card h2 {
    font-size: 18px;
    text-align: center;
    margin-bottom: 20px;
}

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    font-size: 15px;
    background: #FAFBFC;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--primary);
    background: #fff;
}

.code-group {
    display: flex;
    gap: 10px;
}

.code-group .form-input { flex: 1; }

.btn-send-code {
    flex-shrink: 0;
    width: 112px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 14px;
    cursor: pointer;
}

.btn-send-code:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    height: 46px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 6px;
}

.btn-primary:active { opacity: 0.85; }

.login-tip {
    text-align: center;
    color: var(--text-hint);
    font-size: 12px;
    margin-top: 14px;
}

.login-admin-link {
    text-align: center;
    font-size: 12px;
    color: var(--text-hint);
    margin-top: 6px;
}

.login-admin-link a {
    color: var(--primary);
    font-weight: 500;
}

/* ==================== 首页 ==================== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(74,144,217,0.25);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-logo svg { width: 17px; height: 17px; }

.header-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-admin-btn {
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.header-admin-btn:active { background: rgba(255,255,255,0.32); }

.header-logout {
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 14px;
    background: rgba(255,255,255,0.12);
    cursor: pointer;
}

.header-logout:active { background: rgba(255,255,255,0.24); }

.app-content {
    flex: 1;
    padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- 用户信息卡 ---------- */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 19px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta { min-width: 0; flex: 1; }

.user-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
}

.role-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.5;
}

.role-super {
    background: #FFF1E0;
    color: #D46B08;
    border: 1px solid #FFD591;
}

.role-admin {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #BCD9F5;
}

.role-staff {
    background: #F0F9EB;
    color: #389E0D;
    border: 1px solid #C2E7B0;
}

.user-phone {
    font-size: 12px;
    color: var(--text-hint);
    margin-top: 3px;
}

.user-exit {
    flex-shrink: 0;
    align-self: flex-start;
    font-size: 12px;
    color: var(--text-hint);
    background: #F2F3F7;
    border-radius: 12px;
    padding: 4px 12px;
    cursor: pointer;
}

.user-exit:active { background: #E4E6EC; color: var(--text-secondary); }

.user-group-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.group-tag {
    font-size: 11px;
    color: var(--text-secondary);
    background: #F2F3F7;
    border-radius: 6px;
    padding: 2px 8px;
}

/* ---------- Banner 轮播 ---------- */
.carousel {
    position: relative;
    overflow: hidden;
    line-height: 0;
    background: #E8EAEF;
    border-radius: 14px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.carousel > .slides {
    display: flex;
    transition: transform .5s ease;
    will-change: transform;
}

.carousel > .slides > .slide {
    flex: 0 0 100%;
    display: block;
    position: relative;
    line-height: 0;
    overflow: hidden;
}

.carousel img {
    display: block;
    width: 100%;
    height: auto;
}

.carousel .dots {
    position: absolute;
    left: 0; right: 0; bottom: 8px;
    display: flex;
    justify-content: center;
    gap: 6px;
    line-height: 1;
    z-index: 2;
    pointer-events: none;
}

.carousel .dots i {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.55);
    box-shadow: 0 0 3px rgba(0,0,0,.3);
    transition: width .3s ease, background .3s ease;
}

.carousel .dots i.on {
    width: 16px;
    border-radius: 3px;
    background: #fff;
}

/* ---------- 菜单分组：每排 2 个大卡片 ---------- */
.menu-section { margin-bottom: 6px; }

.menu-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 4px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.menu-section-title::before {
    content: '';
    width: 3px;
    height: 13px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.menu-grid.single { grid-template-columns: 1fr; }

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 106px;
    padding: 18px 10px;
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
    overflow: hidden;
}

.menu-item:active {
    transform: scale(.97);
    box-shadow: 0 1px 2px rgba(20,30,50,.04);
}

.menu-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.menu-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.menu-name {
    font-size: 15.5px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-sub {
    font-size: 12px;
    color: #8B939C;
    text-align: center;
    line-height: 1.5;
    max-width: 100%;
    /* 副标题过长时自动换行，最多显示 3 排，超出省略 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    word-break: break-all;
}

/* ---------- 空状态 ---------- */
.empty-state {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 56px 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.empty-icon { font-size: 46px; margin-bottom: 12px; }

.empty-text {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.empty-hint {
    font-size: 12px;
    color: var(--text-hint);
    margin-top: 6px;
}

/* ==================== 弹窗 ==================== */
.modal-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    padding: 24px;
}

.modal-mask.show { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-dialog {
    width: 100%;
    max-width: 340px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    animation: popIn 0.22s ease;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    font-size: 15px;
    color: var(--text-hint);
    cursor: pointer;
    padding: 4px 6px;
}

.text-content {
    margin: 12px 16px;
    max-height: 50vh;
    overflow-y: auto;
    background: #F7F9FB;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-all;
}

.btn-copy-text {
    width: auto;
    margin: 0 16px 16px;
    height: 40px;
    font-size: 14px;
}

/* PC端适配 */
@media (min-width: 560px) {
    .menu-grid { gap: 14px; }
}
