:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --line: #d8dee9;
  --blue: #1e3a8a;
  --green: #168a4a;
  --orange: #d97706;
  --gray: #64748b;
  --red: #dc2626;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
  margin: 0;
}

.topbar {
  align-items: center;
  background: #0f172a;
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 18px 24px;
}

h1, h2, p { margin-top: 0; }
h1 { font-size: 24px; margin-bottom: 0; }
h2 { font-size: 20px; margin-bottom: 4px; }
p { color: var(--muted); }
.topbar p, .topbar h1 { color: #fff; }
.brand {
  background: var(--blue);
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  letter-spacing: 0;
  padding: 7px 10px;
}
.brand.small { font-size: 12px; margin-bottom: 6px; }
.topbar nav { align-items: center; display: flex; gap: 14px; }
.topbar a { color: #bfdbfe; text-decoration: none; }

main {
  display: grid;
  gap: 20px;
  margin: 0 auto;
  max-width: 1500px;
  padding: 24px;
}

.tabs {
  align-items: center;
  display: flex;
  gap: 8px;
}
.tabs button {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
.tabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

section, .login-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  padding: 22px;
}

.panel-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.actions, .controls { display: flex; flex-wrap: wrap; gap: 10px; }
.controls { align-items: end; margin-bottom: 18px; }
.view-controls { margin-bottom: 16px; }
.week-control { min-width: min(430px, 100%); }
.week-control select { width: 100%; }

label { display: grid; gap: 6px; }
label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
input, select, textarea, button {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  min-height: 40px;
  padding: 9px 11px;
}
textarea { resize: vertical; }
button {
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}
button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
button.danger {
  border-color: #fecaca;
  color: #991b1b;
}

.message {
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  margin-bottom: 18px;
  padding: 12px;
}
.message.ok { background: #eff6ff; }
.message.warn { background: #fff7ed; border-color: #fed7aa; }
.message.error { background: #fef2f2; border-color: #fecaca; }

.draft-days {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  overflow-x: auto;
}
.day {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 180px;
  overflow: hidden;
}
.day header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px;
}
.day header strong, .day header span { display: block; }
.day header span { color: var(--muted); font-size: 12px; font-weight: 800; }
.task-list { display: grid; gap: 9px; min-height: 120px; padding: 10px; }
.empty {
  align-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  color: #94a3b8;
  display: flex;
  font-weight: 800;
  justify-content: center;
  min-height: 70px;
}
.task-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 7px;
  display: grid;
  gap: 3px;
  padding: 10px;
  text-align: left;
}
.task-card[data-type="investment"] { border-left-color: var(--green); }
.task-card[data-type="action"] { border-left-color: var(--orange); }
.task-card[data-type="travel"], .task-card[data-type="leave"] { border-left-color: var(--gray); }
.task-card span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.task-card em { color: var(--blue); font-style: normal; font-weight: 900; }
.task-card small { color: var(--muted); font-weight: 700; }

.board-wrap { overflow-x: auto; }
.board {
  display: grid;
  gap: 0;
  grid-template-columns: 170px repeat(var(--days), minmax(190px, 1fr));
  min-width: calc(170px + var(--days) * 190px);
}
.corner, .day-head, .tech-cell, .slot {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 105px;
  padding: 12px;
}
.corner, .day-head { background: #f8fafc; min-height: 62px; }
.tech-cell { background: #f8fafc; font-weight: 900; }
.slot { background: #fff; }
.board-task {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 7px;
  margin: 8px;
  padding: 10px;
  z-index: 2;
}
.board-task div { color: var(--blue); font-weight: 900; }
.board-task.investment { border-left-color: var(--green); }
.board-task.action { border-left-color: var(--orange); }
.board-task.travel, .board-task.leave { border-left-color: var(--gray); background: #f8fafc; }
.board-task.rejected { opacity: 0.55; text-decoration: line-through; }
.badge {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: #166534;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  margin-top: 6px;
  padding: 2px 8px;
}
.validation {
  border-radius: 7px;
  padding: 10px 12px;
}
.validation.ok { background: #ecfdf5; border: 1px solid #bbf7d0; }
.validation.warn { background: #fff7ed; border: 1px solid #fed7aa; }
.validation.error { background: #fef2f2; border: 1px solid #fecaca; }

.modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.55);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 0;
}
.modal[hidden] { display: none; }
.dialog {
  background: #fff;
  border-radius: 8px;
  max-height: calc(100vh - 36px);
  max-width: 760px;
  overflow: auto;
  padding: 20px;
  width: min(760px, 100%);
}
.dialog-head, .dialog-actions {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  margin: 16px 0;
}
.span-full { grid-column: 1 / -1; }
.tech-options { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.tech-options label {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  gap: 8px;
  padding: 10px;
}
.dialog-actions { align-items: center; margin-top: 18px; }

.login-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-panel { max-width: 420px; width: 100%; }
.login-form { display: grid; gap: 14px; }
.login-form button { background: var(--blue); color: #fff; }
.error { color: var(--red); font-weight: 800; margin-bottom: 0; }

@media (max-width: 860px) {
  .topbar, .panel-head { display: block; }
  .actions { margin-top: 12px; }
  .form-grid, .tech-options { grid-template-columns: 1fr; }
  main { padding: 12px; }
  section { padding: 16px; }
}
