* {
    box-sizing: border-box;
}

:root {
    --bg: #050b17;
    --bg-2: #0a1224;
    --panel: #0e172b;
    --panel-2: #101b2e;
    --card: rgba(14, 23, 43, 0.88);
    --border: rgba(175, 188, 255, 0.12);
    --text: #edf3ff;
    --muted: #9ea8c5;
    --accent: #7a5cff;
    --accent-2: #8ae4ff;
    --success: #35d29b;
    --warning: #f0b95a;
    --danger: #ff5f7c;
    --shadow: 0 18px 40px rgba(4, 8, 18, 0.5);
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #050b17 0%, #0a1220 100%);
    color: var(--text);
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
    display: block;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top, rgba(122, 92, 255, 0.18), transparent 35%), #040b16;
    padding: 24px;
}

.login-card {
    width: min(100%, 460px);
    background: rgba(13, 20, 33, 0.94);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 30px 28px;
    box-shadow: var(--shadow);
}

.login-logo,
.sidebar-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.login-logo span,
.sidebar-logo span {
    color: var(--accent-2);
}

.login-label,
.sidebar-label,
.admin-header-label,
.section-label {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    color: var(--accent-2);
    opacity: 0.9;
}

.login-card h1 {
    margin: 12px 0 8px;
    font-size: clamp(2rem, 5vw, 2.7rem);
}

.login-card p {
    margin: 0 0 24px;
    color: var(--muted);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.form-group label {
    color: #dfe6ff;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: rgba(122, 92, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(122, 92, 255, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.admin-btn {
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-weight: 700;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.admin-btn:hover {
    transform: translateY(-1px);
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), #4b7dff);
    color: white;
    margin-top: 10px;
}

.secondary-btn {
    color: var(--text);
    background: rgba(122, 92, 255, 0.12);
    border: 1px solid rgba(122, 92, 255, 0.28);
}

.save-btn {
    background: linear-gradient(135deg, var(--success), #1ba9e4);
    color: white;
    min-width: 220px;
}

.section-save {
    margin-top: 18px;
}

.admin-dashboard {
    display: flex;
    min-height: 100vh;
    background: #050b17;
}

.admin-sidebar {
    width: 280px;
    background: rgba(11, 18, 30, 0.96);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 18px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-top {
    padding: 10px 8px 16px;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    overflow-y: auto;
}

.nav-link {
    text-decoration: none;
    color: var(--muted);
    padding: 11px 12px;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease;
    border: 1px solid transparent;
    font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(122, 92, 255, 0.12);
    color: white;
    border-color: rgba(122, 92, 255, 0.18);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
    margin-bottom: 12px;
    word-break: break-word;
}

.sidebar-user strong {
    color: var(--text);
    font-size: 0.85rem;
}

.logout-btn {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 700;
}

.mobile-sidebar-toggle {
    display: none;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 1.1rem;
    margin: 0 0 14px;
}

.admin-main {
    flex: 1;
    padding: 24px 28px 60px;
    background: linear-gradient(180deg, rgba(7, 12, 20, 0.2), rgba(7, 12, 20, 0.1));
}

.member-welcome-card {
    margin-bottom: 24px;
}

.member-welcome-card h2 {
    margin: 0 0 8px;
}

.member-welcome-card p {
    color: var(--muted);
    margin: 0 0 16px;
}

.member-metric-grid {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    margin-bottom: 28px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.admin-header h1 {
    margin: 8px 0 0;
    font-size: clamp(2rem, 4vw, 3rem);
}

.admin-user {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: right;
    color: var(--muted);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
}

.admin-user strong {
    color: var(--text);
}

.admin-section {
    display: none;
    margin-bottom: 28px;
}

.admin-section.active-section {
    display: block;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.section-title span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(122, 92, 255, 0.14);
    border: 1px solid rgba(122, 92, 255, 0.2);
    font-weight: 700;
    color: var(--accent-2);
}

.section-title h2 {
    margin: 0 0 4px;
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.section-title p {
    margin: 0;
    color: var(--muted);
}

.admin-card {
    background: rgba(14, 23, 43, 0.88);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 16px;
}

.metric-card {
    background: rgba(18, 27, 45, 0.85);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 16px;
}

.metric-label {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.metric-value {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
}

.metric-value.success {
    color: var(--success);
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 20px;
    margin-top: 22px;
}

.mini-header h3 {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-list li {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    color: var(--muted);
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.full-width {
    grid-column: 1 / -1;
}

.profile-photo-area {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.profile-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(122,92,255,0.2), rgba(138,228,255,0.2));
    border: 1px solid rgba(122,92,255,0.35);
    font-size: 2.2rem;
    font-weight: 800;
}

#profileImage {
    width: 100px;
    height: 132px;
    border-radius: 16px;
    object-fit: cover;
    object-position: center top;
    border: 1px solid var(--border);
}

.profile-photo-area img {
    aspect-ratio: 3 / 4;
    display: block;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    color: var(--text);
    cursor: pointer;
}

.toolbar-row {
    margin-bottom: 18px;
    display: flex;
    justify-content: flex-start;
}

.data-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.data-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    padding: 16px;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.data-card-header strong {
    font-size: 1.02rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pill.active {
    background: rgba(53, 210, 155, 0.12);
    color: var(--success);
}

.status-pill.inactive,
.status-pill.archived {
    background: rgba(255, 95, 124, 0.12);
    color: var(--danger);
}

.status-pill.new,
.status-pill.read,
.status-pill.replied {
    background: rgba(122, 92, 255, 0.12);
    color: var(--accent-2);
}

.data-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.data-card-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 0.8rem;
}

.data-card-grid input,
.data-card-grid textarea,
.data-card-grid select {
    background: rgba(7, 14, 25, 0.7);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 9px 10px;
}

.data-card-grid textarea {
    min-height: 80px;
    resize: vertical;
}

.data-card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}

.inline-btn {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
    color: var(--text);
    padding: 9px 12px;
    font-weight: 600;
}

.inline-btn.delete {
    border-color: rgba(255, 95, 124, 0.3);
    color: #ffd2d9;
}

.table-container {
    overflow-x: auto;
}

.table-wrap {
    min-width: 700px;
}

.message-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.message-table th,
.message-table td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 12px 10px;
    vertical-align: top;
}

.message-table th {
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.message-actions button {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    color: var(--text);
    padding: 7px 9px;
    font-size: 0.77rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.analytics-box {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
    padding: 20px 18px;
}

.analytics-box span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.analytics-box strong {
    font-size: 1.15rem;
}

.save-section {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.save-message {
    margin-bottom: 24px;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    border: 1px solid transparent;
}

.save-message.success {
    background: rgba(53, 210, 155, 0.12);
    border-color: rgba(53, 210, 155, 0.35);
    color: #b9f7df;
}

.save-message.error {
    background: rgba(255, 95, 124, 0.12);
    border-color: rgba(255, 95, 124, 0.3);
    color: #ffdfe7;
}

.login-error {
    color: #ffadc0;
    min-height: 18px;
    margin-top: 12px;
    font-weight: 700;
}

.auth-panel h2 {
    margin-bottom: 10px;
}

.auth-panel p {
    color: var(--muted);
    margin-bottom: 18px;
}

.verification-resend-btn {
    width: 100%;
    margin-top: 10px;
}

.verification-status {
    min-height: 18px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.82rem;
}

.empty-state {
    color: var(--muted);
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    text-align: center;
}

.team-editor-card {
    margin-bottom: 20px;
}

.team-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.team-editor-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.team-upload-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    color: var(--muted);
}

.team-upload-status.notice {
    color: var(--accent-2);
    background: rgba(122, 92, 255, 0.08);
}

.team-upload-status.loading {
    color: var(--warning);
    background: rgba(240, 185, 90, 0.08);
}

.team-upload-status.success {
    color: var(--success);
    background: rgba(53, 210, 155, 0.08);
}

.team-upload-status.error {
    color: var(--danger);
    background: rgba(255, 95, 124, 0.08);
}

.team-photo-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.team-photo-preview-area {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-photo-preview-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.team-photo-placeholder {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-2);
}

.team-form-grid {
    margin-bottom: 16px;
}

.team-validation-message {
    display: none;
    margin-top: 6px;
    color: #ffadc0;
    font-size: 0.78rem;
    font-weight: 700;
}

.team-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.team-list-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-list-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-mini-thumb {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(122, 92, 255, 0.12);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-2);
    font-weight: 800;
}

.team-mini-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-list-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
    font-size: 0.83rem;
}

@media (max-width: 1024px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }

    .dashboard-row,
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .admin-dashboard {
        display: block;
    }

    .admin-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(82vw, 285px);
        transform: translateX(-110%);
        transition: transform 0.25s ease;
        z-index: 30;
        box-shadow: var(--shadow);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .mobile-sidebar-toggle {
        display: inline-flex;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 40;
    }

    .admin-main {
        padding-top: 72px;
    }

    .form-grid,
    .data-card-grid,
    .quick-actions,
    .analytics-grid,
    .metric-grid {
        grid-template-columns: 1fr;
    }
}
