/* BRISK M2 - minimal functional UI. Accent: #6B4BCC */

:root {
  --accent: #6B4BCC;
  --accent-dark: #55389f;
  --ink: #23212b;
  --muted: #6d6a78;
  --line: #ddd9e8;
  --bg: #f6f5fa;
  --card: #ffffff;
  --red: #c0392b;
  --green: #1e7e34;
  --amber: #a06a00;
}

* { box-sizing: border-box; }

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

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem 1.25rem;
  background: var(--accent);
  color: #fff;
}
.topbar .brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  color: #fff;
  text-decoration: none;
}
.topbar nav a {
  color: #eae5fa;
  text-decoration: none;
  margin-right: 0.9rem;
  font-size: 0.95rem;
}
.topbar nav a:hover { color: #fff; text-decoration: underline; }
.topbar .role-tag {
  margin-left: auto;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.18);
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
}

main { max-width: 900px; margin: 1.25rem auto 3rem; padding: 0 1rem; }

h1 { font-size: 1.35rem; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.6rem; color: var(--accent-dark); }
h3 { font-size: 0.95rem; margin: 0.9rem 0 0.3rem; }
a { color: var(--accent-dark); }
code {
  background: #efecf7;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.badges { display: flex; gap: 0.4rem; align-items: center; }
.task-id { color: var(--accent-dark); font-weight: 700; }
.muted { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.prewrap { white-space: pre-wrap; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

/* Flash messages */
.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 5px;
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
}
.flash-error { background: #fbe9e7; border: 1px solid #e5b6ae; color: #8f2415; }
.flash-ok { background: #e8f5e9; border: 1px solid #b4d9b7; color: #1d5e26; }
.error-list { margin: 0; padding-left: 1.1rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f1edfb; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.82rem; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-approve { border-color: var(--green); color: var(--green); }
.btn-approve:hover { background: #e8f5e9; }
.btn-reject { border-color: var(--red); color: var(--red); }
.btn-reject:hover { background: #fbe9e7; }

/* Task table */
.task-table { width: 100%; border-collapse: collapse; background: var(--card); }
.task-table th, .task-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.task-table th {
  background: #efecf7;
  color: var(--accent-dark);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.task-table .task-title { text-decoration: none; color: var(--ink); font-weight: 600; }
.task-table .task-title:hover { color: var(--accent-dark); }
.row-overdue td { background: #fff5f4; }

.overdue-marker {
  color: var(--red);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: #ececec;
  color: #444;
}
.state-draft { background: #ececec; color: #555; }
.state-assigned { background: #e3ecfa; color: #23538f; }
.state-reflect_pending { background: #fdf3d7; color: #8a6400; }
.state-in_progress { background: #e6e0f8; color: var(--accent-dark); }
.state-review { background: #d9f0fa; color: #14607e; }
.state-done { background: #e3f4e4; color: var(--green); }
.state-reopened { background: #fbe9e7; color: var(--red); }

.prio-urgent { background: var(--red); color: #fff; }
.prio-high { background: #f0d3cd; color: #8f2415; }
.prio-normal { background: #e6e0f8; color: var(--accent-dark); }
.prio-low { background: #ececec; color: #666; }

.badge.blocking { background: #3a3145; color: #fff; }

/* Forms */
.form .field { margin-bottom: 0.85rem; }
.field-row { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.field-row .field { flex: 1 1 160px; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
input[type="text"], input[type="url"], input[type="date"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 0.92rem;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
textarea { resize: vertical; }

/* Detail page */
.detail-grid {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.3rem 0.8rem;
  margin: 0;
}
.detail-grid dt { font-weight: 600; font-size: 0.88rem; color: var(--muted); }
.detail-grid dd { margin: 0; font-size: 0.92rem; overflow-wrap: anywhere; }
.steps { margin: 0.2rem 0 0; padding-left: 1.3rem; font-size: 0.92rem; }

.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.inline-form {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.inline-form input[type="text"], .inline-form input[type="url"],
.inline-form input[type="number"] { width: auto; min-width: 14rem; }
.inline-form input.narrow { min-width: 7rem; }
.inline-form input[type="file"] { font-size: 0.82rem; }

.reflect-form { margin-top: 0.9rem; }
.reflect-form label { font-weight: 400; }
.reflect-form textarea { margin: 0.35rem 0 0.5rem; }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.check-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 5px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  background: #fff;
}
.check-item.status-done { border-left-color: var(--green); }
.check-item.status-na_approved { border-left-color: var(--muted); }
.check-item.status-na_requested { border-left-color: var(--amber); }
.check-item.status-rejected { border-left-color: var(--red); }
.check-item.status-open { border-left-color: var(--accent); }

.check-head { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.check-text { font-size: 0.94rem; }
.check-meta {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.proof-req { color: var(--amber); font-weight: 600; }

.item-status.status-done { background: #e3f4e4; color: var(--green); }
.item-status.status-open { background: #efecf7; color: var(--accent-dark); }
.item-status.status-na_requested { background: #fdf3d7; color: #8a6400; }
.item-status.status-na_approved { background: #ececec; color: #666; }
.item-status.status-rejected { background: #fbe9e7; color: var(--red); }

.note {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
}
.note-na { background: #fdf3d7; color: #6f5100; }
.note-reject { background: #fbe9e7; color: #8f2415; }

.item-forms {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line);
}
