* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 1.45;
  color: #111;
  background: #fff;
}
h1, h2, h3 { font-weight: 400; margin: 0; }
button, input, textarea, select { font: inherit; font-weight: 300; color: #111; }
button { cursor: pointer; }
a { color: #2563eb; }

/* Header */
header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid #e5e5e5;
}
header h1 { font-size: 18px; margin-right: auto; }
.user-info { font-size: 13px; color: #333; white-space: nowrap; }
.btn {
  border: 1px solid #d4d4d4; background: #fff; border-radius: 4px;
  padding: 5px 12px; font-size: 13px;
}
.btn:hover { border-color: #999; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: #b91c1c; }
.btn:disabled { opacity: .45; cursor: default; }

/* Notifications bell */
.bell-wrap { position: relative; }
.bell-btn { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: #dc2626; color: #fff; border-radius: 8px;
  font-size: 11px; font-weight: 400; line-height: 16px; text-align: center;
}
.badge[hidden] { display: none; }
.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: 340px; max-width: 90vw; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid #d4d4d4; border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.14); padding: 8px;
}
.notif-dropdown[hidden] { display: none; }
.notif-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.notif-head .btn { padding: 3px 8px; font-size: 12px; }
.notif-item { border-top: 1px solid #eee; padding: 8px 2px; }
.notif-item:first-of-type { border-top: 0; }
.notif-item.unread { background: #eff6ff; }
.notif-title { font-weight: 400; }
.notif-body { color: #555; font-size: 13px; }
.notif-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.notif-time { color: #888; font-size: 12px; }
.link-btn { background: none; border: 0; color: #2563eb; padding: 0; font-size: 12px; }

/* Login */
.login-wrap { max-width: 340px; margin: 72px auto 0; padding: 0 16px; }
.login-wrap h2 { font-size: 18px; margin-bottom: 16px; }
.login-wrap label { display: block; font-size: 13px; margin: 10px 0 4px; }
.login-wrap input { width: 100%; padding: 7px 9px; border: 1px solid #d4d4d4; border-radius: 4px; }
.login-wrap .btn-primary { width: 100%; margin-top: 16px; padding: 8px; }
.login-error { color: #b91c1c; font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-error:empty { display: none; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid #e5e5e5; }
.tab-btn {
  border: 1px solid transparent; border-bottom: 0; background: none;
  padding: 7px 14px; font-size: 14px; border-radius: 5px 5px 0 0;
}
.tab-btn.active { border-color: #e5e5e5; background: #fff; font-weight: 400; }
.tab-btn:not(.active) { color: #555; }
.tab-btn:not(.active):hover { color: #111; }
main { padding: 14px 16px 32px; }
.tab-panel[hidden] { display: none; }

/* Countdown */
.countdown { font-variant-numeric: tabular-nums; white-space: nowrap; }
.countdown.big { font-size: 28px; font-weight: 300; }
.countdown.red { color: #dc2626; }
.countdown.done, .countdown.not-started { color: #555; }
.phase-clock { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.phase-clock .phase-label { font-size: 15px; font-weight: 400; }

/* Overview Gantt */
.gantt { width: 100%; }
.gantt-head, .gantt-row {
  display: grid; grid-template-columns: minmax(180px, 1.1fr) 3fr minmax(150px, .9fr);
  gap: 12px; align-items: center;
}
.gantt-head { border-bottom: 1px solid #e5e5e5; padding-bottom: 4px; }
.gantt-row { border-bottom: 1px solid #f0f0f0; padding: 8px 0; }
.gantt-name { font-weight: 400; overflow-wrap: anywhere; }
.gantt-phase { color: #555; font-size: 13px; }
.gantt-time { text-align: right; font-size: 13px; }
.gantt-time .deadline { color: #555; }
.gantt-chart svg, .gantt-axis svg { display: block; width: 100%; height: auto; }
.bar-clickable { cursor: pointer; }
.bar-clickable:hover { opacity: .75; }
.empty { color: #555; padding: 16px 0; }

/* GĐ1 */
.gd1-add { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.gd1-add input { flex: 1; min-width: 200px; padding: 6px 9px; border: 1px solid #d4d4d4; border-radius: 4px; }
table { border-collapse: collapse; width: 100%; margin-bottom: 18px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eee; font-weight: 300; }
th { font-weight: 400; color: #555; font-size: 13px; }
td .btn { padding: 2px 8px; font-size: 12px; }
.industry { border: 1px solid #e5e5e5; border-radius: 6px; padding: 12px; margin-bottom: 14px; }
.industry h3 { font-size: 15px; margin-bottom: 8px; }
.criterion { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-top: 1px solid #f5f5f5; }
.criterion:first-of-type { border-top: 0; }
.criterion input[type="checkbox"] { margin-top: 3px; flex: none; }
.criterion label { flex: 1 1 45%; min-width: 180px; }
.criterion .link-input {
  flex: 1 1 45%; min-width: 160px; padding: 4px 8px;
  border: 1px solid #d4d4d4; border-radius: 4px;
}
.criterion input:disabled, textarea:disabled { background: #f7f7f7; color: #666; }
.reason { width: 100%; min-height: 76px; padding: 8px 9px; border: 1px solid #d4d4d4; border-radius: 4px; resize: vertical; margin: 4px 0 10px; }
.field-label { font-size: 13px; color: #555; display: block; margin-bottom: 2px; }

/* Tasks */
.task-list { list-style: none; margin: 0 0 18px; padding: 0; }
.task-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid #f5f5f5; }
.task-list li:first-child { border-top: 0; }
.task-list .done-at { color: #888; font-size: 12px; margin-left: auto; white-space: nowrap; }
.task-add { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.task-add input { flex: 1; min-width: 200px; padding: 6px 9px; border: 1px solid #d4d4d4; border-radius: 4px; }

/* Gate */
.gate { border-top: 1px solid #e5e5e5; padding-top: 14px; }
.gate h2 { font-size: 16px; margin-bottom: 8px; }
.gate-decisions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.gate-note { width: 100%; min-height: 56px; padding: 8px 9px; border: 1px solid #d4d4d4; border-radius: 4px; resize: vertical; }
.gate-status { padding: 8px 0; }
.gate-status .decision { font-weight: 400; }
.gate-status .note { color: #555; }
.gate-error { color: #b91c1c; font-size: 13px; margin-top: 8px; min-height: 18px; }
.gate-error:empty { display: none; }

/* Lưu đồ */
.luudo-frame { width: 100%; height: calc(100vh - 150px); min-height: 480px; border: 0; }

@media (max-width: 760px) {
  .gantt-head, .gantt-row { grid-template-columns: 1fr; gap: 4px; }
  .gantt-time { text-align: left; }
  .gantt-head .gantt-axis { order: 3; }
  .criterion { flex-wrap: wrap; }
  .criterion label, .criterion .link-input { flex-basis: 100%; }
  .countdown.big { font-size: 22px; }
}
