:root {
  --blue: #005eb8;
  --blue-dark: #003d78;
  --ink: #1a2733;
  --muted: #5b6b79;
  --bg: #f4f7fa;
  --card: #ffffff;
  --line: #d9e1e8;
  --green: #007f3b;
  --red: #d5281b;
  --amber: #b45c00;
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); }
h1, h2, h3 { line-height: 1.25; }

.site-header {
  background: var(--blue);
  color: #fff;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-header .brand { font-weight: 700; font-size: 1.15rem; color: #fff; text-decoration: none; }
.site-header nav { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.site-header nav a {
  color: #fff; text-decoration: none; padding: 0.35rem 0.65rem; border-radius: 6px; font-size: 0.95rem;
}
.site-header nav a:hover, .site-header nav a.active { background: rgba(255, 255, 255, 0.18); }
.badge-dot {
  display: inline-block; min-width: 1.2rem; padding: 0 0.3rem; text-align: center;
  background: var(--red); color: #fff; border-radius: 999px; font-size: 0.75rem; margin-left: 0.25rem;
}

main.wrap { max-width: 60rem; margin: 0 auto; padding: 1rem; }
main.narrow { max-width: 30rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; margin-bottom: 1rem;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.hero { background: var(--blue); color: #fff; padding: 2.5rem 1rem; }
.hero-inner { max-width: 60rem; margin: 0 auto; }
.hero h1 { margin: 0 0 0.6rem; font-size: 1.9rem; }
.hero p { max-width: 38rem; font-size: 1.1rem; margin: 0 0 1.2rem; }

.btn {
  display: inline-block; background: var(--green); color: #fff; border: 0; cursor: pointer;
  padding: 0.65rem 1.2rem; font-size: 1rem; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
.btn.quiet { background: transparent; color: var(--blue); border: 1px solid var(--line); font-weight: 500; }
.btn.danger { background: var(--red); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }

form label { display: block; font-weight: 600; margin: 0.9rem 0 0.25rem; }
form .hint { font-weight: 400; color: var(--muted); font-size: 0.88rem; margin: 0 0 0.3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; padding: 0.6rem; font-size: 1rem; border: 1.5px solid var(--muted);
  border-radius: 6px; background: #fff; color: var(--ink); font-family: inherit;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus { outline: 3px solid #ffd54f; outline-offset: 1px; }

.notice { padding: 0.8rem 1rem; border-radius: 8px; margin: 0.8rem 0; border: 1px solid transparent; }
.notice.error { background: #fbe9e7; border-color: var(--red); color: #7f1c13; }
.notice.ok { background: #e8f5e9; border-color: var(--green); color: #1b4d2b; }
.notice.warn { background: #fff3e0; border-color: var(--amber); color: #6d3a00; }
.notice.info { background: #e3f0fa; border-color: var(--blue); color: var(--blue-dark); }

.tag {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  background: #e3f0fa; color: var(--blue-dark); margin-right: 0.3rem; white-space: nowrap;
}
.tag.critical { background: var(--red); color: #fff; }
.tag.high { background: #ffe0b2; color: #6d3a00; }
.tag.normal { background: #e3f0fa; color: var(--blue-dark); }
.tag.self_service { background: #eceff1; color: var(--muted); }
.tag.status { background: #ede7f6; color: #4527a0; }
.tag.role { background: #e0f2f1; color: #00695c; }
.tag.ai { background: #fce4ec; color: #880e4f; }

.case-list { display: grid; gap: 0.7rem; }
.case-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; text-decoration: none; color: inherit;
}
.case-card:hover { border-color: var(--blue); }
.case-card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.case-card .meta { color: var(--muted); font-size: 0.85rem; }

.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button {
  border: 1px solid var(--line); background: var(--card); padding: 0.4rem 0.8rem; border-radius: 999px;
  cursor: pointer; font-size: 0.9rem; color: var(--ink);
}
.tabs button.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.msg { margin-bottom: 0.8rem; padding: 0.7rem 0.9rem; border-radius: 10px; max-width: 92%; }
.msg .who { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.2rem; }
.msg.member { background: #e3f0fa; }
.msg.advisor { background: #e8f5e9; }
.msg.private { background: #fff8e1; border: 1px dashed var(--amber); }
.msg.system { background: #eceff1; font-size: 0.9rem; }
.msg p:first-of-type { margin-top: 0; } .msg p:last-of-type { margin-bottom: 0; }
.msg .body { white-space: pre-wrap; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-scroll { overflow-x: auto; }

.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 800px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.feature-grid { display: grid; gap: 1rem; }
@media (min-width: 700px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }

.source-item { border-left: 4px solid var(--blue); padding: 0.4rem 0.8rem; margin: 0.5rem 0; background: #f7fafc; font-size: 0.9rem; }
.source-item .kind { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }

.timeline-item { display: flex; gap: 0.7rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--line); font-size: 0.92rem; }
.timeline-item .date { min-width: 6.2rem; font-weight: 600; color: var(--blue-dark); }
.timeline-item .unconfirmed { color: var(--amber); font-size: 0.78rem; }

/* Floating assistant widget */
.assistant-fab {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  width: 3.4rem; height: 3.4rem; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 1.4rem; border: 0; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.assistant-fab:hover { background: var(--blue-dark); }
.assistant-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(26, 39, 51, 0.5);
  display: flex; align-items: flex-end; justify-content: flex-end;
}
.assistant-panel {
  background: var(--bg); width: 100%; height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
}
@media (min-width: 700px) {
  .assistant-overlay { background: transparent; pointer-events: none; padding: 0 1rem 1rem 0; }
  .assistant-panel {
    pointer-events: auto; width: 24rem; height: 34rem; max-height: calc(100vh - 2rem);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.3);
  }
}
.assistant-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.9rem; background: var(--blue); color: #fff;
}
.assistant-head .tag.ai { vertical-align: middle; }
.assistant-headbtn {
  background: rgba(255, 255, 255, 0.15); color: #fff; border: 0; border-radius: 6px;
  padding: 0.25rem 0.6rem; cursor: pointer; font-size: 0.85rem;
}
.assistant-headbtn:hover { background: rgba(255, 255, 255, 0.3); }
.assistant-chatholder { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.assistant-chatwrap { flex: 1; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.assistant-tabs {
  display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center;
  padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); background: var(--card);
}
.assistant-tab {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.8rem; cursor: pointer;
}
.assistant-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.assistant-tab-x { opacity: 0.65; font-size: 0.75rem; }
.assistant-tab-x:hover { opacity: 1; }
.assistant-tab-new { font-weight: 700; }
.assistant-body { flex: 1; overflow-y: auto; padding: 0.8rem; min-height: 0; }
.assistant-body .msg { max-width: 100%; }
.assistant-body textarea { margin-top: 0.3rem; }
.assistant-embed { height: 70vh; min-height: 24rem; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.assistant-inputrow {
  display: flex; gap: 0.5rem; align-items: flex-end;
  padding: 0.6rem; border-top: 1px solid var(--line); background: var(--card);
}
.assistant-inputrow textarea { flex: 1; min-height: 2.6rem; }

.site-footer { color: var(--muted); font-size: 0.85rem; padding: 2rem 1rem; text-align: center; }
.site-footer a { color: var(--muted); }
.hidden { display: none !important; }
.right { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mt0 { margin-top: 0; }
.stack > * + * { margin-top: 0.6rem; }
