@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f4f6fb;
    --bg-soft: #eef3ff;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-strong: #ffffff;
    --line: rgba(125, 102, 224, 0.12);
    --text: #1f2340;
    --muted: #67708d;
    --navy: #2f3f8f;
    --blue: #2d7ff9;
    --cyan: #18b8d9;
    --violet: #7d53de;
    --pink: #df5cb8;
    --orange: #ff9f43;
    --yellow: #ffc857;
    --green: #1dbf84;
    --danger: #ea5455;
    --shadow-lg: 0 26px 60px rgba(60, 72, 140, 0.14);
    --shadow-md: 0 16px 34px rgba(68, 78, 138, 0.12);
    --shadow-sm: 0 8px 18px rgba(74, 83, 140, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at 0% 0%, rgba(125, 83, 222, 0.18), transparent 28%),
        radial-gradient(circle at 100% 0%, rgba(24, 184, 217, 0.18), transparent 26%),
        radial-gradient(circle at 100% 100%, rgba(255, 200, 87, 0.15), transparent 22%),
        linear-gradient(180deg, #f9fbff 0%, #f2f5fd 48%, #eef3fb 100%);
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.38), transparent 75%);
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.metric-value,
.hero-title,
.auth-form-card h2,
.auth-hero-card h1 {
    font-family: 'Fraunces', Georgia, serif;
    letter-spacing: -0.03em;
}

p, span, label, input, select, textarea, button, a, table {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(90deg, rgba(23, 33, 81, 0.94), rgba(45, 127, 249, 0.94), rgba(125, 83, 222, 0.92)) !important;
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 30px rgba(47, 63, 143, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.app-navbar-inner { min-height: 78px; }

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: #fff !important;
    text-decoration: none;
}

.app-brand strong {
    display: block;
    font-size: 1.18rem;
    line-height: 1.1;
}

.app-brand-kicker {
    display: block;
    color: rgba(255, 255, 255, 0.74);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    margin-bottom: 0.18rem;
}

.app-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
    font-size: 1.1rem;
}

.navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.92) !important;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-weight: 700;
    transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.navbar .nav-link.active,
.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

.user-nav-link {
    min-width: 200px;
    justify-content: flex-start;
}

.user-chip {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    font-size: 1rem;
}

.user-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.user-copy small {
    color: rgba(255,255,255,0.72);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

.user-copy strong {
    color: #fff;
    font-size: 0.95rem;
}

.app-dropdown {
    border-radius: 18px;
    padding: 0.55rem;
    min-width: 220px;
}

.app-dropdown .dropdown-item {
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
}

.app-dropdown .dropdown-item:hover {
    background: rgba(45, 127, 249, 0.08);
}

.dropdown-danger {
    color: var(--danger) !important;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
}

.container-fluid { position: relative; z-index: 1; }
main.col-md-12 { padding: 2rem 1rem 3rem !important; }
.page-shell, .dashboard-compact { max-width: 1420px; margin: 0 auto; }

.hero-panel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    background: linear-gradient(135deg, rgba(47, 63, 143, 0.98), rgba(45, 127, 249, 0.95) 45%, rgba(223, 92, 184, 0.92) 100%);
    box-shadow: var(--shadow-lg);
}
.hero-panel::before {
    content: '';
    position: absolute;
    width: 340px;
    height: 340px;
    right: -110px;
    top: -160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.24), transparent 68%);
}
.hero-panel::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    left: -90px;
    bottom: -120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 87, 0.25), transparent 68%);
}
.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.hero-title { margin: 1rem 0 0.55rem; font-size: clamp(2.2rem, 2.8vw, 3.4rem); line-height: 1.03; max-width: 14ch; }
.hero-subtitle { max-width: 760px; margin: 0; color: rgba(255, 255, 255, 0.86); font-size: 1.04rem; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; justify-content: flex-end; align-items: center; height: 100%; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; margin-top: 1.6rem; }
.hero-stat { padding: 1rem 1.1rem; border-radius: 20px; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(8px); }
.hero-stat-label { display: block; margin-bottom: 0.25rem; color: rgba(255, 255, 255, 0.76); font-size: 0.84rem; }
.hero-stat-value { font-size: 1.5rem; font-weight: 800; }

.card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(14px);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 22px 40px rgba(77, 92, 163, 0.16); border-color: rgba(125, 83, 222, 0.2); }
.card-header { background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 248, 255, 0.92)); border-bottom: 1px solid rgba(125, 102, 224, 0.1); padding: 1rem 1.2rem; font-weight: 800; }
.card-header h3, .card-header h5 { margin: 0; font-size: 1.12rem; color: var(--text); }
.card-body { padding: 1.2rem; }

.metric-card { position: relative; overflow: hidden; min-height: 190px; color: #fff; }
.metric-card::after { content: ''; position: absolute; width: 170px; height: 170px; right: -45px; bottom: -65px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.metric-card.primary { background: linear-gradient(135deg, #2d7ff9, #18b8d9); }
.metric-card.success { background: linear-gradient(135deg, #1dbf84, #14a76c); }
.metric-card.warning { background: linear-gradient(135deg, #ff9f43, #ff7a59); }
.metric-card.info { background: linear-gradient(135deg, #7d53de, #df5cb8); }
.metric-label { display: block; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.8); }
.metric-value { margin: 0.35rem 0 0.6rem; font-size: 2.4rem; line-height: 1; }
.metric-context { max-width: 14rem; color: rgba(255, 255, 255, 0.82); }
.metric-icon { width: 60px; height: 60px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.16); font-size: 1.45rem; }

.table { margin-bottom: 0; color: var(--text); }
.table > :not(caption) > * > * { padding: 0.95rem 0.9rem; border-bottom-color: rgba(125, 102, 224, 0.08); }
.table thead th { border-top: none; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.table tbody tr:hover { background: linear-gradient(90deg, rgba(45, 127, 249, 0.035), rgba(223, 92, 184, 0.035)); }
.table a { color: var(--navy); font-weight: 700; }

.badge { padding: 0.45rem 0.82rem; border-radius: 999px; font-weight: 800; letter-spacing: 0.01em; }
.btn { border-radius: 999px; font-weight: 800; padding: 0.78rem 1.15rem; border: 0; transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(63, 79, 150, 0.16); }
.btn-primary, .btn-outline-primary:hover { background: linear-gradient(135deg, var(--violet), var(--pink)); color: #fff; }
.btn-success { background: linear-gradient(135deg, var(--green), #0aa0b8); color: #fff; }
.btn-warning { background: linear-gradient(135deg, var(--yellow), var(--orange)); color: #32220d; }
.btn-danger { background: linear-gradient(135deg, #ff6b6b, var(--danger)); color: #fff; }
.btn-secondary { background: linear-gradient(135deg, #eef2ff, #dde7ff); color: var(--navy); }
.btn-info { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #fff; }
.btn-outline-primary, .btn-outline-secondary { border: 1px solid rgba(45, 127, 249, 0.18); background: rgba(255, 255, 255, 0.72); color: var(--navy); }

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(125, 102, 224, 0.14);
    background: rgba(255, 255, 255, 0.9);
    padding: 0.82rem 0.98rem;
    color: var(--text);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7);
}
.form-control:focus, .form-select:focus { border-color: rgba(125, 83, 222, 0.42); box-shadow: 0 0 0 0.22rem rgba(125, 83, 222, 0.14); }

.modal-content { border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.7); overflow: hidden; box-shadow: var(--shadow-lg); }
.modal-header { background: linear-gradient(135deg, rgba(47, 63, 143, 0.98), rgba(125, 83, 222, 0.94), rgba(223, 92, 184, 0.9)); color: white; border-bottom: none; }
.modal-header .btn-close { filter: invert(1); }
.modal { z-index: 2000; }
.modal-backdrop { z-index: 1990; }
.modal-dialog, .modal-content { pointer-events: auto; }
.dashboard-compact h1 { font-size: 2rem; }
.chart-compact { height: 300px; }
.project-mini { height: 100%; display: flex; gap: 1rem; align-items: flex-start; padding: 1.1rem; border-radius: 18px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(238, 243, 255, 0.95)); border: 1px solid rgba(125, 102, 224, 0.12); }
.project-mini-icon { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(45, 127, 249, 0.14), rgba(223, 92, 184, 0.14)); color: var(--violet); font-size: 1.35rem; }
.project-mini p, .project-mini small { color: var(--muted); }
.page-title { margin-bottom: 1.4rem; }
.page-title h1 { margin: 0; font-size: 2.1rem; }
.page-title p { margin: 0.35rem 0 0; color: var(--muted); max-width: 720px; }
.alert { border: 0; border-radius: 16px; box-shadow: var(--shadow-sm); }

.auth-shell {
    max-width: 1180px;
    margin: 0 auto;
    min-height: calc(100vh - 140px);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.35rem;
    align-items: stretch;
    padding: 1rem 0 2rem;
}

.auth-hero-card,
.auth-form-card {
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
}

.auth-hero-card {
    position: relative;
    overflow: hidden;
    padding: 2.4rem;
    color: #fff;
    background: linear-gradient(140deg, rgba(28, 39, 95, 0.98), rgba(45, 127, 249, 0.95) 48%, rgba(24, 184, 217, 0.88) 100%);
}

.auth-hero-card::before,
.auth-hero-card::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-hero-card::before {
    width: 280px;
    height: 280px;
    right: -80px;
    top: -90px;
    background: radial-gradient(circle, rgba(255,255,255,0.22), transparent 68%);
}

.auth-hero-card::after {
    width: 220px;
    height: 220px;
    left: -70px;
    bottom: -90px;
    background: radial-gradient(circle, rgba(255,200,87,0.25), transparent 68%);
}

.auth-kicker,
.auth-mini-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    padding: 0.48rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-kicker { background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.9); }
.auth-mini-badge { background: rgba(45,127,249,0.08); color: var(--blue); }

.auth-hero-card h1 {
    margin: 1rem 0 0.75rem;
    font-size: clamp(2.3rem, 3vw, 4rem);
    line-height: 1.02;
    max-width: 10ch;
}

.auth-hero-card p {
    max-width: 60ch;
    margin: 0;
    color: rgba(255,255,255,0.84);
    line-height: 1.8;
}

.auth-hero-points {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.6rem;
}

.auth-hero-points div {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
}

.auth-hero-points i {
    margin-top: 0.2rem;
    color: #fff;
}

.auth-form-card {
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(255,255,255,0.7);
    padding: 2rem;
    backdrop-filter: blur(14px);
}

.auth-card-header h2 {
    margin: 0.85rem 0 0.3rem;
    font-size: 2rem;
}

.auth-card-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.75;
}

.auth-form { margin-top: 1.4rem; }
.auth-label { font-weight: 800; color: #344054; }
.auth-input-group { border-radius: 18px; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,0.78); }
.auth-input-group .input-group-text {
    border: 1px solid rgba(125, 102, 224, 0.14);
    border-right: 0;
    background: rgba(247, 249, 255, 0.92);
    color: var(--violet);
}
.auth-input-group .form-control {
    border-left: 0;
    padding-left: 0.2rem;
}
.auth-submit { min-height: 58px; }
.auth-card-footer {
    margin-top: 1.4rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(125, 102, 224, 0.08);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.auth-card-footer a {
    color: var(--navy);
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.mailbox-detail-layout .mailbox-content-box { min-height: 120px; max-height: 280px; overflow: auto; }
.mailbox-detail-layout .mailbox-content-text { white-space: pre-wrap; margin: 0; }
.mailbox-actions-box .form-label { margin-bottom: 0.25rem; font-size: 0.95rem; }
.mailbox-actions-box .form-control, .mailbox-actions-box .form-select { padding: 0.5rem 0.75rem; }
.mailbox-actions-box .nav-tabs .nav-link { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.mailbox-image-thumb img { width: 100%; height: 120px; object-fit: cover; display: block; }
.mail-content-readable { font-size: 0.95rem; line-height: 1.45; color: #1f2937; white-space: normal; }
.mail-content-readable .mail-line { margin: 0 0 0.3rem 0; word-break: break-word; }
.mail-content-readable .mail-line.empty { margin-bottom: 0.75rem; }
.mail-content-readable .mail-line.quoted { border-left: 3px solid #cbd5e1; padding-left: 0.55rem; color: #4b5563; }
.mail-content-readable .mail-line.quoted.q2, .mail-content-readable .mail-line.quoted.q3 { border-left-color: #94a3b8; color: #6b7280; }

@media (min-width: 992px) {
    .mailbox-actions-box { max-height: 72vh; overflow-y: auto; }
}

@media (max-width: 1199px) {
    .auth-shell { grid-template-columns: 1fr; }
    .user-nav-link { min-width: auto; }
}

@media (max-width: 991px) {
    main.col-md-12 { padding: 1.2rem 0.8rem 2rem !important; }
    .hero-panel { padding: 1.5rem; }
    .hero-actions { justify-content: flex-start; margin-top: 1rem; }
    .hero-stats { grid-template-columns: 1fr; }
    .navbar .nav-link { width: 100%; }
    .auth-form-card, .auth-hero-card { padding: 1.5rem; }
}

@media (max-width: 768px) {
    .chart-compact { height: 230px; }
    .metric-card { min-height: auto; }
    .page-title h1, .dashboard-compact h1, .auth-hero-card h1 { font-size: 1.9rem; }
    .hero-title { max-width: none; }
    .auth-card-footer { flex-direction: column; }
}
