:root {
  --navy: #0f2a4a;
  --navy-2: #16395f;
  --accent: #2f7cd6;
  --ink: #1c2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7fb;
  --card: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
#nav a {
  color: #cfe0f2;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
}
#nav a:hover { background: var(--navy-2); color: #fff; }
#nav a.active { background: var(--accent); color: #fff; }
#userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cfe0f2; white-space: nowrap; }

#app { max-width: 1200px; margin: 24px auto; padding: 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:hover td { background: #f8fafc; }

button, .btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
button:hover { filter: brightness(1.06); }
button.secondary { background: #e2e8f0; color: var(--ink); }
button.danger { background: var(--danger); }
button.ghost { background: transparent; color: var(--accent); padding: 4px 8px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 3px; font-weight: 600; }
.field { margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: #eef2f7;
  color: var(--muted);
}
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.delivered { background: #dcfce7; color: var(--ok); }
.badge.pending { background: #fef9c3; color: #a16207; }
.badge.admin { background: #fde2e2; color: var(--danger); }

.tabs { display: flex; gap: 6px; margin: 0 0 16px; flex-wrap: wrap; }
.tabs button {
  background: #e2e8f0;
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 20px;
}
.tabs button.active { background: var(--navy); color: #fff; }

.login-wrap { max-width: 380px; margin: 60px auto; }
.center { text-align: center; }

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  display: none;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
#toast.error { background: var(--danger); }
#toast.ok { background: var(--ok); }

.gantt-bar { height: 18px; border-radius: 4px; margin: 2px 0; }
.gantt-bar.wp { background: var(--navy); }
.gantt-bar.task { background: var(--accent); }
.gantt-bar.deliverable { background: #d97706; }
.gantt-bar.milestone { background: #0d9488; }

.matrix-table th, .matrix-table td { text-align: right; }
.matrix-table th:first-child, .matrix-table td:first-child { text-align: left; }
.matrix-table tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }

pre.json { background: #0f172a; color: #d7e2f0; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12px; }

details { margin: 6px 0; }
summary { cursor: pointer; font-weight: 600; }
