* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.login-box .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Main Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #1e293b;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #334155;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    color: #94a3b8;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #334155;
    color: white;
}

.main-content {
    flex: 1;
    margin-left: 240px;
}

.top-bar {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h1 {
    font-size: 24px;
    color: #1e293b;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #64748b;
}

.content-area {
    padding: 30px;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 32px;
    font-weight: bold;
    color: #1e293b;
}

.stat-card.blue { border-left: 4px solid #3b82f6; }
.stat-card.green { border-left: 4px solid #10b981; }
.stat-card.orange { border-left: 4px solid #f59e0b; }
.stat-card.red { border-left: 4px solid #ef4444; }

/* Data Table */
.data-table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 18px;
    color: #1e293b;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
}

th {
    padding: 12px 20px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
}

td {
    padding: 15px 20px;
    border-top: 1px solid #f1f5f9;
}

tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    color: #1e293b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ---- 登录家族页（登录 / 忘记密码 / 客户注册）共用的验证码部件（#196） ---- */

.sms-note {
    display: none;
    margin: -10px 0 16px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    background: #f8fafc;
    color: #64748b;
}
.sms-note-ok  { background: #ecfdf5; color: #047857; }
.sms-note-err { background: #fef2f2; color: #b91c1c; }
.sms-note-info{ background: #eff6ff; color: #1d4ed8; }

.code-row {
    display: flex;
    gap: 10px;
}
.code-row input { flex: 1 1 auto; min-width: 0; }
.code-row .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 12px 16px;
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}
.code-row .btn:hover:not(:disabled) { background: #e0e7ff; }
.code-row .btn:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

.auth-step {
    border-top: 1px dashed #e2e8f0;
    margin-top: 22px;
    padding-top: 20px;
}
.auth-step-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}
.auth-step-title .n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    font-size: 12px;
    flex: 0 0 auto;
}
.auth-step[hidden] { display: none; }

.auth-hint {
    margin: -10px 0 16px;
    font-size: 12px;
    line-height: 1.7;
    color: #94a3b8;
}
.auth-links {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.auth-links a { color: #667eea; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-verified {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #ecfdf5;
    color: #047857;
    font-size: 13px;
}
.auth-verified button {
    background: none;
    border: none;
    color: #047857;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 0;
}

