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

body {
    font-family: -apple-system, 'Segoe UI', Tahoma, sans-serif;
    background: #f0f0f1;
    color: #1d2327;
    line-height: 1.6;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* لاگین */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 350px;
    text-align: center;
}
.login-box h1 { margin-bottom: 20px; font-size: 20px; color: #2271b1; }
.login-box input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccd0d4;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 12px;
    font-family: inherit;
}
.login-box button {
    width: 100%;
    padding: 12px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-family: inherit;
}
.login-box button:hover { background: #135e96; }
.error { color: #d63638; margin-top: 10px; font-size: 14px; }

/* داشبورد */
header {
    background: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}
header h1 { font-size: 18px; color: #2271b1; }
.icon-btn {
    background: none;
    border: 1px solid #ccd0d4;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
}

.tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 10px;
    position: sticky;
    top: 60px;
    z-index: 9;
}
.tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
}
.tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
    font-weight: bold;
}

.tab-content { padding: 15px; }

.cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}
.card {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.card h3 { font-size: 12px; color: #666; margin-bottom: 8px; font-weight: normal; }
.card p { font-size: 24px; font-weight: bold; color: #2271b1; }

.box {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.box h2 { font-size: 15px; margin-bottom: 12px; }

/* لیست بازدیدکنندگان */
.search-box { margin-bottom: 12px; }
.search-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccd0d4;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.visitor-item {
    background: #fff;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: transform 0.15s;
}
.visitor-item:active { transform: scale(0.98); }
.visitor-item .ip {
    font-family: monospace;
    font-weight: bold;
    color: #2271b1;
    font-size: 14px;
    direction: ltr;
    display: inline-block;
}
.visitor-item .meta {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}
.visitor-item .badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-right: 6px;
}
.visitor-item .badge.user { background: #00a32a; }

/* مودال */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-content {
    background: #fff;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    position: relative;
}
.close-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.detail-row {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
    font-size: 13px;
}
.detail-row strong { color: #2271b1; display: inline-block; min-width: 100px; }

.visit-item {
    padding: 10px;
    background: #f6f7f7;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}
.visit-item .url {
    color: #2271b1;
    word-break: break-all;
    direction: ltr;
    text-align: left;
    font-family: monospace;
}

/* ریسپانسیو */
@media (min-width: 600px) {
    .cards { grid-template-columns: repeat(4, 1fr); }
    .modal { align-items: center; }
    .modal-content { border-radius: 20px; }
}