/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
    min-height: 100vh;
}

/* === Navbar === */
.navbar {
    display: flex; align-items: center; gap: 1.5rem;
    background: #1a1a2e; color: #fff;
    padding: 0 1.5rem; height: 56px;
    position: sticky; top: 0; z-index: 100;
}
.nav-brand strong { font-size: 1.1rem; letter-spacing: 1px; }
.nav-subtitle { font-size: .75rem; opacity: .6; margin-left: .5rem; }
.nav-links { display: flex; gap: .25rem; margin-left: auto; }
.nav-links a {
    color: rgba(255,255,255,.7); text-decoration: none;
    padding: .5rem 1rem; border-radius: 6px; font-size: .9rem;
    transition: .15s;
}
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-user { display: flex; align-items: center; gap: .5rem; margin-left: 1rem; font-size: .85rem; }

/* === Container === */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.container-wide { max-width: 100%; padding: 1.5rem 1rem; }

/* === Typography === */
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-header .page-title { margin-bottom: 0; }
.section-title { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 .75rem; color: #374151; }
.text-muted { color: #6b7280; }
.back-link { color: #2563eb; text-decoration: none; font-size: .9rem; display: inline-block; margin-bottom: .75rem; }
.back-link:hover { text-decoration: underline; }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .5rem 1.25rem; border-radius: 6px; font-size: .9rem;
    font-weight: 500; text-decoration: none; border: none; cursor: pointer;
    transition: .15s;
}
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: #374151; }
.btn-outline:hover { background: #f3f4f6; }

/* === Badges === */
.badge {
    display: inline-block; padding: .15rem .5rem; border-radius: 4px;
    font-size: .75rem; font-weight: 500;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #e5e7eb; color: #374151; }
.status-badge {
    display: inline-block; padding: .2rem .6rem; border-radius: 4px;
    color: #fff; font-size: .75rem; font-weight: 500;
}

/* === Stats Grid === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stats-sm { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat-card {
    background: #fff; border-radius: 10px; padding: 1.25rem;
    text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-number { font-size: 2rem; font-weight: 700; color: #1a1a2e; }
.stat-label { font-size: .85rem; color: #6b7280; margin-top: .25rem; }
.stat-accent { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.stat-accent .stat-number, .stat-accent .stat-label { color: #fff; }
.stat-warn { border: 2px solid #dc2626; }
.stat-warn .stat-number { color: #dc2626; }

/* === Members Grid === */
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.member-card {
    display: block; background: #fff; border-radius: 10px; padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    text-decoration: none; color: inherit; transition: .15s;
}
.member-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-2px); }
.member-name { font-weight: 600; margin-bottom: .25rem; }
.member-dir { font-size: .8rem; color: #6b7280; margin-bottom: .75rem; }
.member-meta { display: flex; justify-content: space-between; font-size: .8rem; color: #6b7280; margin-top: .35rem; }

/* === Progress Bars === */
.progress-bar-container {
    background: #e5e7eb; border-radius: 6px; height: 10px; overflow: hidden;
}
.progress-bar-container.sm { height: 6px; }
.progress-bar { height: 100%; border-radius: 6px; transition: width .3s; min-width: 2px; }
.mini-progress { background: #e5e7eb; border-radius: 4px; height: 6px; overflow: hidden; margin-bottom: .25rem; }
.mini-bar { background: #2563eb; height: 100%; border-radius: 4px; }

/* === Cards === */
.card {
    background: #fff; border-radius: 10px; padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 1rem;
}
.card h3 { font-size: 1rem; margin-bottom: .75rem; }
.card-warn { border-left: 4px solid #d97706; }
.card-review { border-left: 4px solid #2563eb; }

/* === Tables === */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.data-table th { background: #f9fafb; padding: .75rem 1rem; text-align: left; font-size: .8rem; color: #6b7280; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: .75rem 1rem; border-top: 1px solid #f3f4f6; font-size: .9rem; }
.clickable-row { cursor: pointer; transition: .1s; }
.clickable-row:hover { background: #f0f4ff; }
.report-table td { text-align: center; font-size: .8rem; }
.report-table .sticky-col { position: sticky; left: 0; background: #fff; text-align: left; z-index: 1; }
.report-table thead .sticky-col { background: #f9fafb; }
.cell-accepted { background: #dcfce7; }
.cell-submitted, .cell-review { background: #fef3c7; }
.cell-revision { background: #fecaca; }
.cell-pending { background: #f3f4f6; }

/* === Task list === */
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.task-card {
    display: block; background: #fff; border-radius: 8px; padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); text-decoration: none; color: inherit; transition: .15s;
}
.task-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.task-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.task-week { font-weight: 600; color: #2563eb; }
.task-title { font-size: .9rem; margin-bottom: .5rem; }

/* === Task detail === */
.task-detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.task-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; font-size: .85rem; color: #6b7280; }
.task-percent-big { text-align: center; }
.percent-circle {
    width: 80px; height: 80px; border-radius: 50%;
    background: conic-gradient(#2563eb calc(var(--pct) * 1%), #e5e7eb 0);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 700;
}
.percent-circle span { background: #fff; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* === Submissions === */
.submission-card {
    background: #f9fafb; border-radius: 8px; padding: 1rem; margin-bottom: .75rem;
    border-left: 3px solid #d1d5db;
}
.submission-header { display: flex; justify-content: space-between; margin-bottom: .5rem; }
.file-link { color: #2563eb; text-decoration: none; font-size: .9rem; }
.file-link:hover { text-decoration: underline; }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; color: #374151; }
.form-input {
    width: 100%; padding: .5rem .75rem; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: .9rem; transition: .15s;
}
.form-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea.form-input { resize: vertical; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }
.flex-1 { flex: 1; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* === Filter bar === */
.filter-bar { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }

/* === Week group === */
.week-group { margin-bottom: 1.5rem; }
.week-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.week-date { background: #2563eb; color: #fff; padding: .25rem .75rem; border-radius: 6px; font-size: .9rem; }
.week-stage { font-size: .8rem; color: #6b7280; }

/* === Section actions === */
.section-actions { display: flex; gap: .5rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* === Legend === */
.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; font-size: .85rem; }
.legend-item { display: flex; align-items: center; gap: .35rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* === Alert === */
.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: #fecaca; color: #991b1b; }

/* === Login === */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
.login-card { background: #fff; border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { font-size: 1.8rem; letter-spacing: 2px; color: #1a1a2e; }
.login-header p { color: #6b7280; font-size: .85rem; margin-top: .5rem; }

/* === Plan table === */
.plan-bar {
    display: flex; gap: 1.5rem; flex-wrap: wrap;
    padding: .6rem 1rem; background: #fff; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 1rem;
    font-size: .85rem; color: #374151;
}
.plan-table {
    width: 100%; border-collapse: collapse; background: #fff;
    border: 1px solid #d1d5db;
}
.plan-table th {
    background: #1a1a2e; color: #fff; padding: .5rem .6rem;
    font-size: .8rem; font-weight: 600; text-align: left;
    border: 1px solid #374151;
    position: sticky; top: 56px; z-index: 10;
}
.plan-table td { padding: .45rem .6rem; border: 1px solid #d1d5db; font-size: .84rem; vertical-align: top; }

.plan-stage-row td {
    background: #2563eb; color: #fff; font-weight: 600;
    font-size: .84rem; padding: .5rem .75rem;
}
.plan-stage-pct { float: right; opacity: .85; font-weight: 400; }

.plan-week-row td {
    background: #eef2ff; color: #3730a3; font-weight: 600;
    font-size: .8rem; padding: .35rem .75rem;
}

.plan-row { cursor: pointer; transition: background .1s; }
.plan-row:hover { background: #f0f4ff; }
.plan-row--done { background: #f0fdf4; }
.plan-row--done:hover { background: #dcfce7; }
.plan-row--over { background: #fef2f2; }
.plan-row--over:hover { background: #fee2e2; }

.plan-n { text-align: center; color: #6b7280; font-size: .8rem; }
.plan-title { line-height: 1.35; }
.plan-result { margin-top: .2rem; font-size: .78rem; color: #16a34a; }
.plan-who { font-size: .8rem; color: #374151; }
.plan-date { font-size: .82rem; text-align: center; white-space: nowrap; }
.plan-status { text-align: center; }
.plan-pct { text-align: center; font-size: .85rem; color: #6b7280; }
.pct-high { color: #16a34a; }
.pct-mid { color: #d97706; }
.pct-low { color: #dc2626; }

.text-center { text-align: center; }
.text-overdue { color: #dc2626; font-weight: 600; }

.plan-legend {
    display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem;
    padding: .6rem; font-size: .82rem; color: #6b7280;
}

.export-buttons { display: flex; gap: .5rem; }

/* === Card variants === */
.card-settings { border-left: 4px solid #6366f1; }
.card-success { border-left: 4px solid #16a34a; background: #f0fdf4; }

/* === Responsive === */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: .75rem; gap: .5rem; }
    .nav-links { order: 3; width: 100%; }
    .nav-user { margin-left: auto; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .task-detail-header { flex-direction: column; }
    .form-row { flex-direction: column; }
}
