/* ReBuilder Medical — Discovery Workspace */
:root {
    --navy: #1e3a5f;
    --blue: #2563eb;
    --blue-soft: #eaf1fe;
    --amber: #b45309;
    --amber-soft: #fef3e2;
    --bg: #f4f6f9;
    --line: #e2e8f0;
    --text: #1f2937;
    --muted: #6b7280;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* ---- Auth screens ---- */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--navy);
}
.auth-card {
    background: #fff; padding: 32px; border-radius: 12px;
    width: 360px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.auth-card .brand { color: var(--blue); font-weight: 700; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; }
.auth-card h1 { margin: 8px 0 4px; font-size: 22px; }
.auth-card label { display: block; margin: 16px 0 0; font-size: 14px; font-weight: 600; }
.auth-card input { width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.auth-card button { margin-top: 20px; width: 100%; padding: 11px; background: var(--blue); color: #fff; border: 0; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.auth-card button:hover { background: #1d4ed8; }

.alert { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: #fde8e8; color: #b91c1c; font-size: 14px; }
.alert.ok { background: #e7f6ec; color: #15803d; }

/* ---- Top bar ---- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--navy); color: #fff; padding: 0 20px; height: 56px;
}
.topbar-brand { font-weight: 700; letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topbar-right a { color: #cfe0f5; }
.topbar-right .who { color: #cfe0f5; }

/* ---- Layout ---- */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 320px; background: #fff; border-right: 1px solid var(--line); padding: 14px 0 40px; overflow-y: auto; }
.main { flex: 1; padding: 24px 28px; max-width: 820px; }

/* ---- Sidebar ---- */
.group-label { padding: 14px 18px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 18px; color: var(--text); font-size: 14px; border-left: 3px solid transparent;
}
.cat-list a:hover { background: var(--bg); text-decoration: none; }
.cat-list a.active { background: var(--blue-soft); border-left-color: var(--blue); font-weight: 600; }
.cat-name { display: flex; align-items: center; gap: 6px; }
.cat-meta { display: flex; align-items: center; gap: 8px; }
.count { background: var(--navy); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }

.fda { background: var(--amber-soft); color: var(--amber); font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; letter-spacing: .4px; vertical-align: middle; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #cbd5e1; }
.status-open { background: #cbd5e1; }
.status-in_progress { background: #f59e0b; }
.status-understood { background: #22c55e; }
.status-needs_decision { background: #ef4444; }

.add-cat { margin: 18px 18px 0; }
.add-cat summary { cursor: pointer; color: var(--blue); font-size: 14px; }
.add-cat form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.add-cat input { padding: 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.add-cat button { padding: 8px; background: var(--blue); color: #fff; border: 0; border-radius: 6px; cursor: pointer; }

/* ---- Category header ---- */
.cat-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 20px; }
.cat-header h1 { margin: 0 0 2px; font-size: 22px; }
.status-form label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.status-form select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }

/* ---- Notes ---- */
.notes { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.empty { padding: 24px 0; }
.note { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; border-left: 4px solid #cbd5e1; }
.note-eric { border-left-color: var(--blue); }
.note-gail { border-left-color: #8b5cf6; }
.note-head { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.note-head .author { font-weight: 700; }
.note-head .time { color: var(--muted); }
.note-head .del { margin-left: auto; }
.note-head .del button { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.note-head .del button:hover { color: #ef4444; }
.note-body { font-size: 15px; line-height: 1.5; white-space: normal; }

/* ---- Add note ---- */
.add-note { display: flex; flex-direction: column; gap: 10px; }
.add-note textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; resize: vertical; }
.add-note button { align-self: flex-start; padding: 10px 20px; background: var(--blue); color: #fff; border: 0; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.add-note button:hover { background: #1d4ed8; }

/* ---- Account page ---- */
.account-wrap { max-width: 560px; margin: 28px auto; padding: 0 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; margin-top: 18px; }
.card h2 { margin: 0 0 14px; font-size: 17px; }
.card label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.card input { display: block; width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.card button { padding: 10px 18px; background: var(--blue); color: #fff; border: 0; border-radius: 8px; font-weight: 600; cursor: pointer; }
.reset-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.reset-row .reset-name { min-width: 160px; font-size: 14px; }
.reset-row input { flex: 1; margin: 0; }

/* ---- Dashboard ---- */
.dash-wrap { max-width: 1040px; margin: 28px auto; padding: 0 24px; }
.dash-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 8px; }
.dash-head h1 { margin: 0; font-size: 24px; }
.dash-stats { color: var(--muted); font-size: 14px; }
.dash-stats strong { color: var(--text); }
.dash-stats .sep { margin: 0 8px; }

.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.dept-card {
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px;
    color: var(--text); display: flex; flex-direction: column; gap: 6px;
    transition: box-shadow .15s, transform .15s, border-color .15s;
}
.dept-card:hover { text-decoration: none; box-shadow: 0 8px 24px rgba(30,58,95,.12); transform: translateY(-2px); border-color: #c7d6ec; }
.dept-icon { font-size: 30px; line-height: 1; }
.dept-name { font-weight: 700; font-size: 16px; color: var(--navy); }
.dept-meta { font-size: 13px; color: var(--muted); }
.dept-meta .sep { margin: 0 6px; }
.dept-status { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 7px; }
.dept-card.unsorted { border-style: dashed; }

.add-dept { margin: 22px 0 0; }
.add-dept summary { cursor: pointer; color: var(--blue); font-size: 14px; }
.add-dept form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-dept input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.add-dept .icon-in { width: 56px; text-align: center; }
.add-dept button { padding: 9px 18px; background: var(--blue); color: #fff; border: 0; border-radius: 8px; font-weight: 600; cursor: pointer; }

/* ---- Breadcrumb ---- */
.breadcrumb { padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line); font-size: 14px; }
.breadcrumb a { color: var(--blue); }
.crumb-sep { color: var(--muted); margin: 0 8px; }
.crumb-current { font-weight: 600; }
