:root {
    --color-primary: #5FB878;
    --color-primary-hover: #4a9e62;
    --color-danger: #FF5722;
    --color-warning: #FFB800;
    --color-info: #2F4056;
    --color-muted: #999;
    --radius: 6px;
}

body {
    background: #f2f2f2;
    font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.layui-main-custom {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 20px 0 8px;
}

.page-header .header-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #5FB878;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-header .header-icon-wrap i {
    font-size: 24px;
    color: #fff;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 2px 0;
    color: #333;
}

.page-header .subtitle {
    font-size: 0.85rem;
    color: #999;
}

/* ===== Form Hints ===== */
.form-hint {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    padding-left: 2px;
}

/* ===== Funnel ===== */
.funnel-wrap {
    display: flex;
    align-items: stretch;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.funnel-step {
    flex: 1;
    text-align: center;
    padding: 24px 16px;
    position: relative;
    transition: all 0.2s;
    cursor: default;
    min-width: 0;
}

.funnel-step:hover {
    filter: brightness(0.95);
}

.funnel-step .step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 18px;
}

.funnel-step .step-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.funnel-step .step-count {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 2px;
}

.funnel-step .step-rate {
    font-size: 12px;
    opacity: 0.65;
}

.funnel-step.step-visit { background: #f6f6f6; }
.funnel-step.step-visit .step-icon { background: #e6e6e6; color: #666; }
.funnel-step.step-visit .step-count,
.funnel-step.step-visit .step-label { color: #555; }

.funnel-step.step-reg { background: #e8f4fd; }
.funnel-step.step-reg .step-icon { background: #d0e9fc; color: #2196F3; }
.funnel-step.step-reg .step-count,
.funnel-step.step-reg .step-label { color: #1976D2; }

.funnel-step.step-tenant { background: #fff8e1; }
.funnel-step.step-tenant .step-icon { background: #ffecb3; color: #FF9800; }
.funnel-step.step-tenant .step-count,
.funnel-step.step-tenant .step-label { color: #E65100; }

.funnel-step.step-landlord { background: #fce4ec; }
.funnel-step.step-landlord .step-icon { background: #f8bbd0; color: #E91E63; }
.funnel-step.step-landlord .step-count,
.funnel-step.step-landlord .step-label { color: #AD1457; }

.funnel-arrow {
    align-self: center;
    color: #ccc;
    font-size: 18px;
    padding: 0 4px;
    z-index: 1;
    flex-shrink: 0;
}

/* ===== Table Enhancements ===== */
.table-wrap {
    max-height: 60vh;
    overflow-y: auto;
}

.layui-table tbody tr.row-visit { border-left: 3px solid #ccc; }
.layui-table tbody tr.row-reg { border-left: 3px solid #2196F3; }
.layui-table tbody tr.row-tenant { border-left: 3px solid #FF9800; }
.layui-table tbody tr.row-landlord { border-left: 3px solid #E91E63; }

.layui-table tbody tr.row-visit:hover { background: #fafafa !important; }
.layui-table tbody tr.row-reg:hover { background: #e3f2fd !important; }
.layui-table tbody tr.row-tenant:hover { background: #fff3e0 !important; }
.layui-table tbody tr.row-landlord:hover { background: #fce4ec !important; }

.cell-link-id {
    font-family: "SF Mono", "Consolas", monospace;
    color: #5FB878;
    font-weight: 500;
    font-size: 13px;
}

.cell-ip {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 12px;
    white-space: nowrap;
}

.cell-datetime {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.cell-empty {
    color: #ccc;
}

/* ===== Status Badge ===== */
.badge-custom {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-visit { background: #f0f0f0; color: #999; }
.badge-reg { background: #e3f2fd; color: #1976D2; }
.badge-tenant { background: #fff3e0; color: #E65100; }
.badge-landlord { background: #fce4ec; color: #AD1457; }

/* ===== Empty / Loading / Error States ===== */
.state-box {
    text-align: center;
    padding: 64px 24px;
}

.state-box .state-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 16px;
    color: #d2d2d2;
}

.state-box .state-icon.error { color: #ffb3b3; }

.state-box .state-title {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.state-box .state-desc {
    font-size: 13px;
    color: #999;
    max-width: 360px;
    margin: 0 auto;
    line-height: 1.6;
}

.loading-overlay {
    text-align: center;
    padding: 48px 24px;
}

.spinner-custom {
    width: 36px;
    height: 36px;
    border: 3px solid #e6e6e6;
    border-top-color: #5FB878;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Animation ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.animate-in {
    animation: fadeInUp 0.35s ease-out forwards;
}

.animate-in.anim-done {
    animation: none;
    opacity: 1;
    transform: none;
}

/* ===== LayUI Card Adjust ===== */
.layui-card {
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 16px;
    overflow: visible;
}

.layui-card-body {
    overflow: visible;
}

/* ===== LayUI Select Dropdown Fix ===== */
.layui-form-select {
    overflow: visible;
}

.layui-form-select dl,
.layui-form-selected dl,
.layui-anim-upbit,
.layui-anim.layui-anim-upbit {
    z-index: 99999 !important;
}

.layui-card-header {
    font-weight: 600;
    font-size: 14px;
}

/* ===== Button Enhance ===== */
.layui-btn-primary:hover {
    border-color: #5FB878 !important;
    color: #5FB878 !important;
}

.layui-btn-primary {
    transition: all 0.2s ease;
}

/* ===== Date Toggle Button ===== */
.btn-toggle-range {
    border: 1px dashed #d2d2d2 !important;
    color: #999 !important;
    background: #fafafa !important;
}
.btn-toggle-range:hover {
    border-color: #5FB878 !important;
    color: #5FB878 !important;
    background: #f6fef9 !important;
}

@media (max-width: 768px) {
    .layui-main-custom { padding: 16px 10px 32px; }
    .page-header { padding-top: 8px; }
    .page-header h1 { font-size: 1.2rem; }
    .funnel-wrap { flex-direction: column; }
    .funnel-arrow { transform: rotate(90deg); padding: 6px 0; }
}
