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

:root {
    --bg: #F7F7FB;
    --surface: #FFFFFF;
    --text: #14151A;
    --text-muted: #6B7280;
    --border: #ECEDF2;

    --purple: #6C5CE7;
    --purple-light: #EDEBFB;
    --coral: #F4645A;
    --coral-dark: #E14F44;

    --stat-purple-bg: #EEECFB;
    --stat-blue-bg: #E7F1FC;
    --stat-mint-bg: #E4F8ED;
    --stat-pink-bg: #FDEAEA;

    --green: #15A26B;
    --green-bg: #DEF7EA;
    --yellow: #B98900;
    --yellow-bg: #FFF6DC;
    --red: #E14F4F;
    --red-bg: #FDEAEA;
    --gray: #6B7280;
    --gray-bg: #EEF0F3;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { min-height: 100vh; display: flex; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 24px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand:hover { text-decoration: none; }

.logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #8B7CF0 0%, #F4645A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.logo-badge .mark {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 3px;
}

.brand-title { font-weight: 800; font-size: 14.5px; color: var(--text); letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1px; }

.sidenav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidenav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
}
.sidenav a:hover { background: var(--gray-bg); text-decoration: none; }
.sidenav a.active { background: var(--purple-light); color: var(--purple); font-weight: 600; }
.sidenav a svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border-radius: 9px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    background: var(--surface);
}
.logout-btn:hover { background: var(--gray-bg); text-decoration: none; }

/* ---------- Content ---------- */
.content { flex: 1; padding: 36px 40px 60px; max-width: 1180px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.eyebrow { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--purple); text-transform: uppercase; margin-bottom: 6px; }
.page-title { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
.title-underline { width: 46px; height: 3px; border-radius: 2px; margin-top: 10px; background: linear-gradient(90deg, var(--purple), var(--coral)); }
.subtitle { color: var(--text-muted); margin: 10px 0 0; font-size: 14px; }

h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin: 36px 0 14px; display: flex; align-items: center; gap: 8px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
}

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat-box {
    border-radius: 14px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.stat-box.tint-purple { background: var(--stat-purple-bg); }
.stat-box.tint-blue { background: var(--stat-blue-bg); }
.stat-box.tint-mint { background: var(--stat-mint-bg); }
.stat-box.tint-pink { background: var(--stat-pink-bg); }
.stat-box .stat-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-box .stat-value { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -0.01em; }

.flag-list { display: flex; flex-direction: column; gap: 10px; }
.flag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--stat-pink-bg);
    border: 1px solid #F7D3D0;
    border-radius: 12px;
    padding: 13px 18px;
}
.flag-item .flag-text { font-size: 14px; }
.flag-item .flag-brand { font-weight: 700; }
.empty-state {
    color: var(--text-muted);
    padding: 30px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 14px;
    font-size: 14px;
    background: var(--surface);
}

table { width: 100%; border-collapse: collapse; background: var(--surface); }
thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--gray-bg);
    padding: 12px 16px;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFD; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.table-wrap table { border: none; border-radius: 0; }

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filters select, .filters input[type="text"] {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--coral);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--coral-dark); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); text-transform: none; font-weight: 600; }
.btn-secondary:hover { background: var(--gray-bg); }
.btn-danger { background: var(--surface); color: var(--red); border: 1px solid #F7D3D0; text-transform: none; font-weight: 600; }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 6px 13px; font-size: 12px; }

.actions-row { display: flex; gap: 8px; align-items: center; }

form .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full-width { grid-column: 1 / -1; }
.form-field label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.form-field .hint { font-size: 12px; color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="date"], input[type="file"], select, textarea {
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-light); }
textarea { resize: vertical; min-height: 80px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

fieldset { border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin: 0 0 20px; background: var(--surface); }
legend {
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--purple);
    padding: 0 8px;
}

.form-actions { margin-top: 24px; display: flex; gap: 10px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 40px; width: 100%; max-width: 360px; box-shadow: 0 20px 50px -20px rgba(20,21,26,0.12); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-card .form-field { margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.error-msg { background: var(--red-bg); color: var(--red); padding: 11px 15px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.success-msg { background: var(--green-bg); color: var(--green); padding: 11px 15px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }

.detail-section { margin-bottom: 28px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.detail-item .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 6px; }
.detail-item .value { font-size: 15px; font-weight: 600; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }

.activity-log { list-style: none; margin: 0; padding: 0; }
.activity-log li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); }
.activity-log li:last-child { border-bottom: none; }
.activity-log .activity-time { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.notes-box { white-space: pre-wrap; background: var(--gray-bg); border-radius: 12px; padding: 16px; font-size: 14px; }

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; padding: 14px 16px; overflow-x: auto; }
    .sidebar-brand { border-bottom: none; padding: 0 14px 0 0; margin: 0; border-right: 1px solid var(--border); }
    .sidenav { flex-direction: row; }
    .sidebar-bottom { border-top: none; margin: 0; padding: 0 0 0 10px; }
    .logout-btn { width: auto; white-space: nowrap; }
    .content { padding: 22px 16px 40px; }
    .page-title { font-size: 26px; }
}
