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

:root {
    --primary: #4a90d9;
    --primary-dark: #357abd;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --bg: #f5f6fa;
    --card: #fff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e0e0e0;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--primary);
    color: #fff;
    padding: 16px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .back-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    text-decoration: none;
    font-size: 16px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Form */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn:active { opacity: 0.7; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
}

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 52px;
    z-index: 99;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* List */
.list-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item:last-child { border-bottom: none; }

.list-item .info { flex: 1; }
.list-item .info .title { font-weight: 500; }
.list-item .info .sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.list-item .actions { display: flex; gap: 6px; }

/* Tag */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    background: #e8f4fd;
    color: var(--primary);
    margin-right: 4px;
}

.tag-death { background: #fde8e8; color: var(--danger); }

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

.modal-overlay.show { display: flex; }

.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 999;
    display: none;
}

.toast.show {
    display: block;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

/* Graph page */
.graph-container {
    width: 100%;
    height: calc(100vh - 52px);
    position: relative;
}

.graph-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.graph-toolbar .btn {
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    font-size: 16px;
}

/* Node tooltip */
.node-tooltip {
    position: absolute;
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 12px;
    z-index: 50;
    display: none;
    min-width: 150px;
}

/* Login page specific */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 24px;
}

.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 32px;
}

.switch-link {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.switch-link a {
    color: var(--primary);
    text-decoration: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

/* Gender icons */
.gender-male { color: #3498db; }
.gender-female { color: #e91e63; }
