/* ============================================================
   NCA Supported Project Management System — Main Stylesheet
   ============================================================ */

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

:root {
    --blue:       #185FA5;
    --blue-dark:  #0C447C;
    --blue-light: #E6F1FB;
    --blue-mid:   #B5D4F4;
    --green:      #3B6D11;
    --green-light:#EAF3DE;
    --amber:      #854F0B;
    --amber-light:#FAEEDA;
    --red:        #A32D2D;
    --red-light:  #FCEBEB;
    --gray-50:    #F9FAFB;
    --gray-100:   #F3F4F6;
    --gray-200:   #E5E7EB;
    --gray-400:   #9CA3AF;
    --gray-600:   #4B5563;
    --gray-800:   #1F2937;
    --white:      #FFFFFF;
    --radius-sm:  6px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.07);
    --shadow-md:  0 4px 12px rgba(0,0,0,.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
    line-height: 1.6;
}

/* ---- Typography ---- */
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
a  { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
.app-wrapper   { display: flex; flex-direction: column; min-height: 100vh; }
.app-body      { display: flex; flex: 1; }
.main-content  { flex: 1; padding: 1.5rem; overflow-x: hidden; min-width: 0; }
.page-header   { margin-bottom: 1.5rem; }
.page-title    { font-size: 20px; font-weight: 600; color: var(--gray-800); }
.page-subtitle { font-size: 13px; color: var(--gray-400); margin-top: 2px; }

/* ---- Topbar ---- */
.topbar {
    background: var(--blue);
    padding: 0 1.25rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo  {
    width: 36px; height: 36px;
    background: rgba(255,255,255,.15);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.topbar-logo svg { width: 22px; height: 22px; }
.brand-text  { line-height: 1.3; }
.brand-name  { font-size: 14px; font-weight: 600; color: #E6F1FB; }
.brand-sub   { font-size: 11px; color: var(--blue-mid); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip    { display: flex; align-items: center; gap: 8px; color: var(--blue-mid); font-size: 13px; }
.user-avatar  {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--blue-dark);
    color: var(--blue-mid);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.user-info    { display: flex; flex-direction: column; line-height: 1.3; }
.user-name    { color: #E6F1FB; font-size: 13px; font-weight: 500; }
.user-role    { font-size: 11px; color: var(--blue-mid); }
.btn-logout   {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: #E6F1FB;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.2); }

/* ---- Sidebar ---- */
.sidebar {
    width: 210px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 1rem 0;
    flex-shrink: 0;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}
.nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--gray-400);
    padding: 10px 16px 4px;
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    font-size: 13.5px;
    color: var(--gray-600);
    cursor: pointer;
    border-left: 3px solid transparent;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.nav-item svg  { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: var(--gray-50); color: var(--gray-800); text-decoration: none; }
.nav-item.active {
    border-left-color: var(--blue);
    background: var(--blue-light);
    color: var(--blue-dark);
    font-weight: 500;
}
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 12px 14px; margin-top: 8px; }

/* ---- Cards ---- */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--gray-200);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.stat-card  { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1rem 1.25rem; box-shadow: var(--shadow-sm); }
.stat-num   { font-size: 28px; font-weight: 700; color: var(--blue); line-height: 1.1; }
.stat-lbl   { font-size: 12px; color: var(--gray-400); margin-top: 3px; }
.stat-card.green .stat-num  { color: var(--green); }
.stat-card.amber .stat-num  { color: var(--amber); }
.stat-card.red   .stat-num  { color: var(--red); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 13.5px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary  { background: var(--blue);  color: #fff; }
.btn-primary:hover { background: var(--blue-dark); text-decoration: none; color: #fff; }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover { background: #2d5509; text-decoration: none; color: #fff; }
.btn-danger   { background: var(--red);   color: #fff; }
.btn-danger:hover { background: #7F1D1D; text-decoration: none; color: #fff; }
.btn-outline  { background: var(--white); color: var(--gray-600); border-color: var(--gray-200); }
.btn-outline:hover { background: var(--gray-50); text-decoration: none; color: var(--gray-800); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group    { margin-bottom: 1rem; }
.form-label    { display: block; font-size: 12.5px; font-weight: 500; color: var(--gray-600); margin-bottom: 5px; }
.form-control  {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24,95,165,.12);
}
.form-control[readonly] { background: var(--gray-50); color: var(--gray-400); }
textarea.form-control   { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint   { font-size: 11.5px; color: var(--gray-400); margin-top: 4px; }

/* ---- Checkbox items ---- */
.check-list   { display: flex; flex-direction: column; gap: 9px; }
.check-item   { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; cursor: pointer; line-height: 1.5; }
.check-item input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; accent-color: var(--blue); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); }
table      { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th   { background: var(--gray-50); color: var(--gray-600); font-weight: 600; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
tbody td   { padding: 10px 14px; border-bottom: 1px solid var(--gray-200); color: var(--gray-800); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-blue   { background: var(--blue-light); color: var(--blue-dark); }
.badge-green  { background: var(--green-light); color: var(--green); }
.badge-amber  { background: var(--amber-light); color: var(--amber); }
.badge-red    { background: var(--red-light); color: var(--red); }

/* ---- Alerts / Flash ---- */
.alert { padding: 11px 16px; border-radius: var(--radius-md); font-size: 13.5px; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 8px; }
.alert-success { background: var(--green-light); color: var(--green);  border-left: 3px solid var(--green); }
.alert-error   { background: var(--red-light);   color: var(--red);    border-left: 3px solid var(--red); }
.alert-info    { background: var(--blue-light);  color: var(--blue-dark); border-left: 3px solid var(--blue); }
.alert-warning { background: var(--amber-light); color: var(--amber);  border-left: 3px solid var(--amber); }

/* ---- Report rows ---- */
.report-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s;
}
.report-item:hover { border-color: var(--blue); }
.report-meta { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.report-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ---- Login page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0C447C 0%, #185FA5 60%, #1D6BB5 100%);
    padding: 2rem 1rem;
}
.login-box  {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.login-header {
    background: var(--blue);
    padding: 1.75rem 1.5rem;
    text-align: center;
}
.login-logo {
    width: 60px; height: 60px;
    background: rgba(255,255,255,.15);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 12px;
}
.login-logo svg { width: 34px; height: 34px; }
.login-title { font-size: 16px; font-weight: 700; color: #E6F1FB; line-height: 1.3; }
.login-sub   { font-size: 12px; color: var(--blue-mid); margin-top: 4px; }
.login-body  { padding: 1.75rem 1.5rem; }
.login-footer { text-align: center; margin-top: 1.25rem; font-size: 12px; color: var(--gray-400); }

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 2rem 1rem;
    z-index: 200;
    overflow-y: auto;
}
.modal-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 560px;
    box-shadow: var(--shadow-md);
    margin: auto;
}
.modal-header {
    background: var(--blue);
    padding: 13px 18px;
    display: flex; align-items: center; justify-content: space-between;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title { color: #E6F1FB; font-size: 14px; font-weight: 600; }
.modal-close {
    background: none; border: none; color: #E6F1FB;
    font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-body { padding: 1.25rem; max-height: 75vh; overflow-y: auto; }

/* ---- Step bar ---- */
.step-bar { display: flex; margin-bottom: 1.25rem; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--gray-200); }
.step-item { flex: 1; text-align: center; padding: 8px 4px; font-size: 12px; background: var(--gray-50); color: var(--gray-400); border-right: 1px solid var(--gray-200); }
.step-item:last-child { border-right: none; }
.step-item.active { background: var(--blue); color: #fff; font-weight: 600; }
.step-item.done   { background: var(--green-light); color: var(--green); }

/* ---- Topic category blocks ---- */
.topic-cat {
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12.5px;
    font-weight: 600;
}
.topic-cat-a { background: var(--blue-light);  color: var(--blue-dark); }
.topic-cat-b { background: var(--green-light); color: var(--green); }

/* ---- People grid ---- */
.people-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.people-total-bar {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    margin-top: 6px;
}

/* ---- Avatar ---- */
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
}

/* ---- Section divider ---- */
.section-divider { font-size: 13px; font-weight: 600; color: var(--gray-600); margin: 1.25rem 0 .75rem; padding-bottom: 6px; border-bottom: 1px solid var(--gray-200); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--gray-400); }
.empty-state svg { width: 44px; height: 44px; opacity: .4; margin-bottom: 10px; }

/* ---- Filter bar ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar select, .filter-bar input { width: auto; padding: 7px 10px; font-size: 13px; }

/* ---- Print ---- */
@media print {
    .sidebar, .topbar, .btn, .report-actions, .filter-bar { display: none !important; }
    .main-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ---- Mobile ---- */
@media (max-width: 700px) {
    .sidebar { display: none; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .brand-sub, .user-info .user-role { display: none; }
    .people-grid { grid-template-columns: 1fr 1fr; }
    table { font-size: 12px; }
    thead th, tbody td { padding: 8px 10px; }
    .main-content { padding: 1rem; }
}
