/* Research Task Manager */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4f46e5; --primary-dark: #4338ca;
  --bg: #f3f4f6; --card: #ffffff; --border: #e5e7eb;
  --text: #111827; --muted: #6b7280;
  --green: #16a34a; --amber: #d97706; --red: #dc2626; --blue: #2563eb;
}
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #1e1b4b; color: #e0e7ff; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { font-size: 16px; font-weight: 700; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-name { font-weight: 600; color: #fff; font-size: 13px; }
.user-role { font-size: 11px; color: #a5b4fc; }
.sidebar nav { display: flex; flex-direction: column; padding: 10px 0; }
.sidebar nav a { color: #c7d2fe; padding: 10px 18px; font-size: 13px; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a.logout { margin-top: 12px; color: #fca5a5; }
.content { flex: 1; padding: 28px; max-width: 1200px; }
.content-public { max-width: 440px; margin: 8vh auto; padding: 0 16px; }

/* Cards, headers */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 20px; }
h2 { font-size: 15px; margin-bottom: 12px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.s-pending .num { color: var(--amber); }
.stat.s-progress .num { color: var(--blue); }
.stat.s-completed .num { color: var(--green); }
.stat.s-overdue .num { color: var(--red); }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d2fe; border-color: var(--primary); }
.form-row { display: flex; gap: 14px; }
.form-row > div { flex: 1; }
.btn { display: inline-block; background: var(--primary); color: #fff; border: none; padding: 9px 18px; border-radius: 6px; font-size: 14px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #eef2ff; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-green { background: var(--green); }
.mt { margin-top: 14px; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; background: var(--card); }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--border); }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:hover td { background: #fafafa; }
.sub-task td:first-child { padding-left: 34px; position: relative; }
.sub-task td:first-child::before { content: "\21B3"; position: absolute; left: 14px; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-overdue { background: #fee2e2; color: #991b1b; }
.badge-tactical { background: #f0b429; color: #1f2937; }
.badge-planned { background: #2c5f8a; color: #ffffff; }

/* Capacity hour grid */
.hour-grid td { text-align: center; font-size: 11px; font-weight: 600; padding: 6px 8px; }
.cell-tactical { background: #f0b429; color: #1f2937; }
.cell-planned { background: #2c5f8a; color: #fff; }
.cell-empty { background: #fff; }
.cell-leave { background: #fee2e2; color: #991b1b; font-weight: 600; }
.cap-over { background: #fee2e2; color: #991b1b; font-weight: 700; }
.legend .l-tactical::before { background: #f0b429; }
.legend .l-planned2::before { background: #2c5f8a; }
.legend .l-leave::before { background: #fee2e2; border: 1px solid #fecaca; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Auth box */
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.auth-card h1 { font-size: 18px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.auth-links { margin-top: 14px; font-size: 13px; text-align: center; }

/* Filters */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters > div { min-width: 150px; }
.filters label { margin-top: 0; }

/* Comments */
.comment { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.comment .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.comment .meta strong { color: var(--text); }

/* Gantt */
.gantt { overflow-x: auto; }
.gantt-group { font-weight: 700; font-size: 14px; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--border); }
.gantt-label .badge { padding: 1px 7px; font-size: 10px; }
.gantt-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 0 6px 220px; }
.gantt-row { display: flex; align-items: center; margin-bottom: 8px; }
.gantt-label { width: 260px; flex-shrink: 0; font-size: 12px; padding-right: 12px; overflow: hidden; }
.gantt-label > a { white-space: nowrap; }
.gantt-track { flex: 1; background: #f3f4f6; border-radius: 4px; height: 22px; position: relative; min-width: 400px; }
.gantt-bar { position: absolute; top: 0; height: 100%; border-radius: 4px; font-size: 10px; color: #fff; display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; }
.gantt-bar.pending { background: var(--amber); }
.gantt-bar.in_progress { background: var(--blue); }
.gantt-bar.completed { background: var(--green); }
.gantt-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--red); z-index: 2; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.legend .l-pending::before { background: var(--amber); }
.legend .l-progress::before { background: var(--blue); }
.legend .l-completed::before { background: var(--green); }
.legend .l-today::before { background: var(--red); }

/* Capacity usage bars */
.usage-bar { background: #f3f4f6; border: 1px solid var(--border); border-radius: 20px; height: 10px; overflow: hidden; margin-bottom: 2px; }
.usage-fill { height: 100%; border-radius: 20px; }
.usage-fill.u-low { background: var(--green); }
.usage-fill.u-mid { background: var(--amber); }
.usage-fill.u-high { background: var(--red); }

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 13px; color: var(--text); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.pagination .dots { border: none; background: none; }
.pagination .pg-label { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 400; }
.pagination .pg-select { width: auto; padding: 6px 8px; font-size: 13px; }

/* Sortable headers */
th a.sort-link { color: var(--muted); }
th a.sort-link:hover { color: var(--primary); text-decoration: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.inline-form { display: inline; }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
}
@media print {
  .sidebar, .filters, .btn, .page-head .btn { display: none !important; }
  .content { padding: 0; max-width: 100%; }
}
