/* 登录门、身份标识、账号管理、审计日志 —— 服务端版新增的界面 */

/* ---- 登录门 ---- */
.gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f5f6f8;
    padding: 24px;
}
.gate-card {
    background: #fff;
    border-radius: 14px;
    padding: 48px 40px;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 4px 28px rgba(0, 0, 0, .08);
}
.gate-icon {
    font-size: 32px;
    color: #9ca3af;
    margin-bottom: 20px;
}
.gate-card h1 {
    font-size: 20px;
    margin: 0 0 12px;
    color: #1f2937;
}
.gate-card p {
    color: #6b7280;
    line-height: 1.8;
    font-size: 14px;
    margin: 0;
}

/* ---- 顶栏身份标识 ---- */
.hr-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 16px;
    flex-shrink: 0;      /* 顶栏变窄时不要把姓名压成竖排 */
    white-space: nowrap;
}
.hr-save-status {
    font-size: 12px;
    min-width: 62px;
    text-align: right;
}
.hr-user {
    font-size: 13px;
    color: var(--text, #1f2937);
    font-weight: 500;
}
.hr-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}
/* 反馈入口：带文字的实心按钮。这是唯一一条用户主动给我们信息的通道，
   藏成一个灰图标就等于没有。 */
.hr-feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 999px;
    background: var(--primary, #4f46e5);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(79, 70, 229, .3);
    transition: background .15s, transform .15s, box-shadow .15s;
}
.hr-feedback-btn:hover {
    background: var(--primary-dark, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(79, 70, 229, .35);
}
.hr-feedback-btn:active { transform: translateY(0); }
.hr-feedback-btn i { font-size: 12px; }

/* 窄屏优先保证主界面可用，此时收回成图标 */
@media (max-width: 1100px) {
    .hr-feedback-btn { padding: 7px 10px; }
    .hr-feedback-btn span,
    .hr-feedback-btn { font-size: 12px; }
}

.hr-role-admin  { background: #fef3c7; color: #92400e; }
.hr-role-hr     { background: #dbeafe; color: #1e40af; }
.hr-role-viewer { background: #f3f4f6; color: #4b5563; }

/* ---- 提示条 ---- */
.hr-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    max-width: 80vw;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    transition: opacity .5s;
}

/* ---- 邀请表单 ---- */
.invite-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.invite-form input,
.invite-form select {
    padding: 9px 12px;
    border: 1.5px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 8px);
    font-size: 13px;
    flex: 1;
    min-width: 150px;
}

/* ---- 账号列表 ---- */
.account-row {
    padding: 14px 0;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.account-main {
    display: flex;
    align-items: center;
    gap: 10px;
}
.account-sub {
    font-size: 12px;
    color: var(--text-light, #6b7280);
    margin: 4px 0 10px;
}
.account-off {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #fee2e2;
    color: #991b1b;
}
.account-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.account-actions select {
    padding: 5px 8px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: 12px;
}

/* ---- 链接弹窗 ---- */
.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    max-width: 560px;
    width: 90vw;
}
.modal-box h3 {
    margin: 0 0 4px;
    font-size: 17px;
}
.link-box {
    width: 100%;
    min-height: 72px;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
    border: 1.5px solid var(--border, #e5e7eb);
    border-radius: 8px;
    resize: vertical;
    word-break: break-all;
    background: #f9fafb;
}

/* ---- 审计日志 ---- */
.audit-box {
    max-height: 420px;
    overflow-y: auto;
}
/* 审计行按「元信息一行 + 详情一行」排版。早先用五列网格，详情列被挤到
   每行一个字符，宽度一变就散架，改成纵向堆叠后任意宽度都读得下去。 */
.audit-row {
    padding: 8px 0;
    font-size: 12px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
}
.audit-time,
.audit-ip {
    color: var(--text-light, #6b7280);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    white-space: nowrap;
}
.audit-who {
    font-weight: 500;
    white-space: nowrap;
}
.audit-act {
    color: #1e40af;
    white-space: nowrap;
}
.audit-detail {
    color: var(--text-light, #6b7280);
    flex-basis: 100%;
    overflow-wrap: anywhere;
}

.account-pending {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e0e7ff;
    color: #3730a3;
}

/* ---- 反馈弹窗 ---- */
.fb-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin: 14px 0 6px;
}
.fb-label:first-child { margin-top: 0; }
.fb-select,
.fb-text {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 8px);
    font-size: 13px;
    font-family: inherit;
}
.fb-text {
    min-height: 130px;
    resize: vertical;
    line-height: 1.7;
}
.fb-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 12px;
    line-height: 1.7;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 14px 0 8px;
}
.fb-note {
    font-size: 12px;
    color: var(--text-light, #6b7280);
    margin: 0;
}

/* ---- 反馈列表 ---- */
.fb-filter { margin-bottom: 14px; }
.fb-filter select {
    padding: 6px 10px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: 12px;
}
.fb-item {
    border: 1px solid var(--border, #e5e7eb);
    border-left: 3px solid #d1d5db;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.fb-item.fb-new  { border-left-color: #f59e0b; background: #fffdf7; }
.fb-item.fb-ack  { border-left-color: #3b82f6; }
.fb-item.fb-done { border-left-color: #10b981; opacity: .72; }
.fb-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    margin-bottom: 8px;
}
.fb-cat {
    background: #eef2ff;
    color: #3730a3;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.fb-page {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--text-light, #6b7280);
}
.fb-time { color: var(--text-light, #6b7280); font-size: 11px; }
.fb-body {
    font-size: 13px;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-bottom: 8px;
}
.fb-ctx {
    font-size: 11px;
    color: var(--text-light, #6b7280);
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}
.fb-ctx summary { cursor: pointer; }
.fb-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---- 使用情况 ---- */
.ins-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.ins-tile {
    background: #f9fafb;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
}
.ins-tile b { display: block; font-size: 20px; line-height: 1.3; }
.ins-tile span { font-size: 11px; color: var(--text-light, #6b7280); }
.ins-tile.warn { background: #fffbeb; border-color: #fde68a; }
.ins-tile.warn b { color: #b45309; }
.ins-tile.bad  { background: #fef2f2; border-color: #fecaca; }
.ins-tile.bad b { color: #b91c1c; }

.ins-h {
    font-size: 13px;
    margin: 16px 0 8px;
    color: var(--text, #1f2937);
}
.ins-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 12px;
}
.ins-k { flex: 1; overflow-wrap: anywhere; }
.ins-sub {
    color: var(--text-light, #6b7280);
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow-wrap: anywhere;
}
.ins-tag {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 9px;
    background: #f3f4f6;
    color: #4b5563;
    white-space: nowrap;
}
.ins-n {
    font-weight: 600;
    min-width: 40px;
    text-align: right;
    white-space: nowrap;
}

/* ---- 顶栏未处理反馈红点 ---- */
.hr-bell {
    position: relative;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-light, #6b7280);
    font-size: 16px;
    line-height: 1;
}
.hr-bell:hover { color: var(--primary, #4f46e5); }
.hr-bell-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--card, #fff);
}
.hr-bell-dot[hidden] { display: none; }

/* 从红点跳过来时闪一下，提示「你要找的在这儿」 */
@keyframes hrFlash {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); }
    40%  { box-shadow: 0 0 0 6px rgba(239, 68, 68, .18); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.hr-flash { animation: hrFlash 1.2s ease-out; }
