/* ===== 基础 ===== */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #1f2937;
    background: #f3f4f6;
    font-size: 14px;
}

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

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex: 0 0 220px;
    background: #111827;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}
.sidebar-brand {
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #1f2937;
}
.brand-dot {
    width: 10px; height: 10px; border-radius: 3px;
    background: #6366f1;
    display: inline-block;
}
.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    margin-bottom: 4px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: #1f2937; color: #fff; }
.nav-item.active { background: #374151; color: #fff; }
.nav-icon {
    width: 18px; height: 18px;
    background: currentColor;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
    opacity: .85;
}
/* 内置图标（使用 mask 简化） */
.nav-icon[data-icon="dashboard"] { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z'/></svg>"); }
.nav-icon[data-icon="item"] { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 6h16v3H4zm0 5h16v3H4zm0 5h16v3H4z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 6h16v3H4zm0 5h16v3H4zm0 5h16v3H4z'/></svg>"); }
.nav-icon[data-icon="category"] { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M10 3H4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1zm0 10H4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1zm10-10h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1zm0 10h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M10 3H4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1zm0 10H4a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1zm10-10h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1zm0 10h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1z'/></svg>"); }
.nav-icon[data-icon="key"] { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12.65 10A5.99 5.99 0 0 0 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6a5.99 5.99 0 0 0 5.65-4H17v4h4v-4h2v-4H12.65zM7 14c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12.65 10A5.99 5.99 0 0 0 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6a5.99 5.99 0 0 0 5.65-4H17v4h4v-4h2v-4H12.65zM7 14c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z'/></svg>"); }
.sidebar-foot {
    padding: 14px 20px;
    font-size: 12px;
    color: #6b7280;
    border-top: 1px solid #1f2937;
}

.main {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-title { font-size: 18px; font-weight: 600; margin: 0; }
.badge-user {
    background: #eef2ff; color: #4338ca;
    padding: 4px 10px; border-radius: 999px; font-size: 12px;
}
.content { padding: 24px; }

/* ===== 卡片 ===== */
.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
}
.card-label { color: #6b7280; font-size: 13px; }
.card-value { font-size: 28px; font-weight: 700; margin: 8px 0 4px; }
.card-foot { color: #9ca3af; font-size: 12px; }
.card-green { border-top: 3px solid #10b981; }
.card-gray { border-top: 3px solid #9ca3af; }
.card-amber { border-top: 3px solid #f59e0b; }

/* ===== 面板 ===== */
.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.panel-head h2 { font-size: 15px; margin: 0; }

/* ===== 工具栏 ===== */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    text-align: left; padding: 11px 12px;
    border-bottom: 1px solid #f1f5f9; white-space: nowrap;
}
.table thead th {
    background: #f9fafb; color: #4b5563; font-weight: 600; font-size: 13px;
}
.table tbody tr:hover { background: #f9fafb; }
.sort-link { color: #374151; }
.sort-link:hover { color: #4338ca; }
.col-actions { white-space: nowrap; }

/* ===== 标签 ===== */
.tag {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 500;
}
.tag-active { background: #d1fae5; color: #047857; }
.tag-inactive { background: #f3f4f6; color: #6b7280; }
.tag-pending { background: #fef3c7; color: #b45309; }

/* ===== 按钮 / 链接 ===== */
.btn {
    display: inline-block; padding: 8px 14px; border-radius: 8px;
    border: 1px solid #d1d5db; background: #fff; color: #374151;
    cursor: pointer; font-size: 13px; line-height: 1; transition: background .15s;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-ghost { background: transparent; border-color: #e5e7eb; color: #6b7280; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.link { color: #4f46e5; margin-right: 10px; }
.link:hover { text-decoration: underline; }
.link-danger { color: #dc2626; background: none; border: none; padding: 0; cursor: pointer; font-size: 14px; }
.inline-form { display: inline; }

/* ===== 表单 ===== */
.form { max-width: 720px; }
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-label { display: block; margin-bottom: 6px; color: #4b5563; font-weight: 500; }
.req { color: #dc2626; }
.input {
    border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px;
    font-size: 14px; background: #fff; color: #1f2937;
}
.input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px #e0e7ff; }
.input-block { width: 100%; display: block; }
textarea.input { resize: vertical; }
.form-actions { margin-top: 8px; }

/* ===== 详情 ===== */
.detail { margin: 0; }
.detail-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.detail-row dt { width: 120px; color: #6b7280; flex: 0 0 120px; }
.detail-row dd { margin: 0; flex: 1; }

/* ===== 提示 ===== */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.empty { color: #9ca3af; padding: 24px 0; text-align: center; }
.hint { color: #9ca3af; font-size: 12px; margin-left: 4px; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-link {
    display: inline-block; min-width: 34px; text-align: center;
    padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 7px;
    color: #374151; font-size: 13px;
}
.page-link:hover { background: #f9fafb; }
.page-link.active { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.page-link.disabled { color: #cbd5e1; pointer-events: none; }
.page-ellipsis { color: #9ca3af; padding: 0 4px; }
.page-info { margin-left: auto; color: #6b7280; font-size: 13px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
}


/* ===== 凭据模块 ===== */
.tag-type { background: #e0e7ff; color: #4338ca; }
.tag-expired { background: #fee2e2; color: #b91c1c; margin-left: 4px; }
.text-danger { color: #dc2626; }
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}
.copy-btn {
    background: none; border: none; color: #4f46e5; cursor: pointer;
    font-size: 14px; padding: 0; font-family: inherit;
}
.copy-btn:hover { text-decoration: underline; }

.secret-box {
    margin-top: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
}
.secret-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}
.secret-mono {
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-all;
    background: #fafafa;
    line-height: 1.5;
}

/* ===== 登录页 ===== */
.login-body {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 32px 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.login-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 17px; font-weight: 700; color: #111827;
    margin-bottom: 20px;
}
.login-title { font-size: 22px; margin: 0 0 18px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.login-hint {
    margin-top: 16px; text-align: center;
    color: #9ca3af; font-size: 12px;
}

/* ===== 类型 Tab 导航（凭据列表） ===== */
.tabs {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 14px;
}
.tab-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    font-size: 13px;
    text-decoration: none;
    transition: all .15s;
}
.tab-item:hover { border-color: #c7d2fe; color: #4338ca; }
.tab-item.active { background: #1f4e79; border-color: #1f4e79; color: #fff; }
.tab-count {
    font-size: 11px;
    background: rgba(0, 0, 0, .08);
    border-radius: 8px;
    padding: 1px 7px;
}
.tab-item.active .tab-count { background: rgba(255, 255, 255, .22); }
.muted { color: #9ca3af; }
/* 详情页：类型专属字段行 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2px 18px;
}
