:root {
    --glass-bg: rgba(15, 23, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --accent: #6366f1;
    --text-main: #f8fafc;
    --text-muted: rgba(248, 250, 252, 0.7);
    --radius: 18px;
    --radius-sm: 12px;
    --input-bg: rgba(15, 23, 42, 0.6);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(145deg, #0b1120 0%, #151d30 50%, #1e293b 100%);
    color: var(--text-main); 
    min-height: 100dvh; 
    padding: 16px 12px; 
    position: relative; 
    overflow-x: hidden;
}
body::before {
    content: ''; position: fixed; inset: -30%;
    background: radial-gradient(circle at 20% 30%, rgba(99,102,241,0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(139,92,246,0.25) 0%, transparent 50%);
    z-index: -1; animation: drift 30s ease-in-out infinite alternate;
}
@keyframes drift { 0% { transform: translate(0, 0) rotate(0deg); } 100% { transform: translate(-30px, 20px) rotate(2deg); } }
.container { max-width: 680px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.header { 
    display: flex; align-items: center; justify-content: space-between; 
    margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
    background: rgba(15, 23, 42, 0.7);
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.logo-small {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
}
h1 {
    font-size: clamp(1.2rem, 5vw, 1.6rem); 
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #c7d2fe);
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    flex: 1;
}
.user-info { 
    display: flex; align-items: center; gap: 8px; 
    background: rgba(99,102,241,0.2); 
    padding: 6px 12px; 
    border-radius: 12px; 
    border: 1px solid rgba(99,102,241,0.3);
}
.user-name { font-weight: 600; color: #fff; font-size: 0.85rem; }
.admin-badge { 
    background: linear-gradient(135deg, #f59e0b, #d97706); 
    color: #fff; padding: 3px 8px; 
    border-radius: 6px; font-size: 0.65rem; font-weight: 700; 
}
.logout-btn {
    background: rgba(239,68,68,0.2); 
    border: 1px solid rgba(239,68,68,0.3); 
    color: #fecaca;
    padding: 6px 12px; 
    border-radius: 8px; 
    text-decoration: none; 
    font-size: 0.8rem; 
}
.auth-wrap { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; }
.logo-wrap {
    margin-bottom: 28px;
    display: flex;
    justify-content: center;
}
.logo-wrap img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 0 2px rgba(255,255,255,0.12);
    display: block;
}
.glass {
    background: var(--glass-bg); 
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border); 
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow); 
    padding: 18px; 
    margin-bottom: 16px;
}
.tabs { display: flex; gap: 6px; margin-bottom: 24px; background: rgba(0,0,0,0.25); padding: 5px; border-radius: 16px; }
.tab {
    flex: 1; padding: 11px; border-radius: 12px;
    color: var(--text-muted); font-weight: 600; cursor: pointer; 
    text-align: center; font-size: 0.95rem;
}
.tab.active { background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff; }
.form-section { display: none; }
.form-section.active { display: block; animation: upFade 0.35s ease; }
@keyframes upFade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
input, textarea {
    width: 100%; 
    padding: 14px 16px; 
    margin-bottom: 12px;
    background: var(--input-bg); 
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm); 
    color: #fff !important; 
    font-size: 15px; 
    font-family: inherit;
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.6) !important; }
input:focus, textarea:focus { 
    outline: none; 
    background: rgba(15, 23, 42, 0.8); 
    border-color: #818cf8; 
    box-shadow: 0 0 0 3px rgba(129,140,248,0.2); 
}
.chk { display: flex; align-items: center; gap: 10px; margin: 14px 0 20px; color: var(--text-muted); font-size: 0.9rem; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--accent); }
button {
    width: 100%; 
    padding: 15px; 
    background: linear-gradient(135deg, var(--accent), #8b5cf6); 
    color: #fff !important; 
    font-weight: 700; 
    border: none; 
    border-radius: var(--radius-sm); 
    cursor: pointer;
    font-size: 16px; 
    box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}
button:active { transform: scale(0.98); } 
.msg { 
    text-align: center; 
    padding: 12px 16px; 
    border-radius: 12px; 
    margin-bottom: 16px; 
    font-weight: 600; 
    font-size: 0.9rem;
}
.msg.err { 
    background: rgba(239,68,68,0.25); 
    border: 1px solid rgba(239,68,68,0.4); 
    color: #fca5a5; 
}
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row input { flex: 1; min-width: 140px; margin-bottom: 0; }
.search-row button { flex: 0 0 auto; width: auto; padding: 14px 24px; margin-bottom: 0; }
.msg.ok { 
    background: rgba(16,185,129,0.25); 
    border: 1px solid rgba(16,185,129,0.4); 
    color: #6ee7b7; 
}
.record {
    border-left: 4px solid #8b5cf6; 
    padding: 16px; 
    background: rgba(15, 23, 42, 0.5);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0; 
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}
.record h3 { font-size: 1.1rem; margin-bottom: 8px; font-weight: 700; color: #fff; }
.record .meta { font-size: 0.8rem; color: rgba(255,255,255,0.7); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 10px; }
.record p { color: rgba(255,255,255,0.9); margin-bottom: 10px; white-space: pre-wrap; line-height: 1.5; }
.record img { max-width: 100%; border-radius: 10px; margin-top: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.record-actions { display: flex; gap: 8px; margin-top: 12px; }
.record-actions a, .record-actions button {
    flex: 1; text-align: center; padding: 9px; border-radius: 8px; 
    font-size: 0.85rem; font-weight: 600; text-decoration: none; cursor: pointer; border: none;
}
.btn-edit { background: rgba(99,102,241,0.3); color: #c7d2fe !important; border: 1px solid rgba(99,102,241,0.4); }
.btn-del { background: rgba(239,68,68,0.25); color: #fecaca !important; border: 1px solid rgba(239,68,68,0.35); }
.btn-secondary { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2); color: #fff !important; }
.edit-form { background: rgba(0,0,0,0.3); padding: 16px; border-radius: 12px; margin-top: 12px; border: 1px solid rgba(255,255,255,0.1); }
.edit-form h4 { margin-bottom: 12px; color: #fff; font-size: 1rem; }
.empty { text-align: center; color: rgba(255,255,255,0.6); padding: 28px 0; font-style: italic; }
input[type="file"] { background: rgba(255,255,255,0.08); padding: 12px; cursor: pointer; color: #fff !important; }
input[type="date"] { color-scheme: dark; color: #fff !important; }
label { color: rgba(255,255,255,0.8) !important; font-weight: 500; }
@media (max-width: 480px) {
    body { padding: 12px 8px; }
    .glass { padding: 16px 14px; background: rgba(15, 23, 42, 0.9); }
    .header { flex-direction: column; align-items: stretch; padding: 10px 14px; }
    .logo-small { width: 40px; height: 40px; margin: 0 auto 8px; }
    h1 { text-align: center; margin-bottom: 8px; font-size: 1.3rem; -webkit-text-fill-color: #fff; }
    .user-info { justify-content: center; margin-top: 4px; }
    .search-row { flex-direction: column; }
    .search-row input, .search-row button { width: 100%; margin-bottom: 10px; }
    input, textarea { font-size: 16px; padding: 13px 14px; background: rgba(15, 23, 42, 0.7); }
    .record { padding: 14px; background: rgba(15, 23, 42, 0.6); }
    .record-actions { flex-direction: column; }
}