/* Medriq photos: plain, quiet styles. No external fonts or CDNs (local network only). */
:root {
    --ink: #1d2430;
    --muted: #5f6b7a;
    --line: #dde2e8;
    --bg: #f5f7f9;
    --card: #ffffff;
    --accent: #1f6f8b;
    --accent-ink: #ffffff;
    --warn: #a15c00;
    --warn-bg: #fff4e0;
    --bad: #a32020;
    --bad-bg: #fdeaea;
    --ok: #1d7a3a;
    --ok-bg: #e6f5ea;
    --radius: 8px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 .8rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { margin-left: auto; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: .6rem; }
.hidden { display: none; }

/* ---- top bar */
.topbar { display: flex; align-items: center; gap: 1.2rem; background: #17324a; color: #fff; padding: .55rem 1.2rem; flex-wrap: wrap; }
.topbar a { color: #dfe9f2; }
.topbar a.active { color: #fff; font-weight: 600; }
.topbar .brand { font-weight: 700; color: #fff; letter-spacing: .02em; }
.topbar form { margin: 0; }
.topbar button.link { background: none; border: none; color: #dfe9f2; cursor: pointer; font: inherit; padding: 0; }
.count { background: #e0a400; color: #1d2430; border-radius: 10px; padding: 0 .45rem; font-size: .8rem; margin-left: .2rem; }
main { padding: 1rem 1.2rem 3rem; max-width: 1600px; margin: 0 auto; }

/* ---- forms */
input, select, textarea, button { font: inherit; }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
    border: 1px solid var(--line); border-radius: 6px; padding: .4rem .55rem; background: #fff; min-width: 0;
}
textarea { width: 100%; min-height: 4rem; }
label.field > input, label.field > select, label.field > textarea { max-width: 100%; box-sizing: border-box; }
.card { min-width: 0; }
label.field { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { color: var(--ink); font-size: .95rem; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; padding: .4rem .8rem; cursor: pointer; display: inline-block; }
.btn:hover { border-color: #b9c2cc; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: .2rem .5rem; font-size: .85rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; align-items: end;
           background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: 1rem; }
.filters .wide { grid-column: span 2; }

/* ---- cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e9edf1; display: block; }
.tile .cap { padding: .35rem .5rem .45rem; font-size: .82rem; line-height: 1.3; }
.tile .cap .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.selected { outline: 3px solid var(--accent); }
.tile .check { position: absolute; top: .35rem; left: .35rem; width: 1.2rem; height: 1.2rem; }
.tile > .badge { position: absolute; top: .35rem; right: .35rem; }
.play { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.55); color: #fff;
        border-radius: 50%; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; font-size: 1rem; pointer-events: none; }

.badge { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 10px; background: #e8edf2; color: var(--muted); white-space: nowrap; }
.badge.skintel { background: #e3eef8; color: #1f4f7a; }
.badge.anue { background: #f6e8ef; color: #7a2f55; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.star { background: #fff3c4; color: #7a5a00; }

.notice { border-radius: var(--radius); padding: .6rem .8rem; margin: .6rem 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
table.list th, table.list td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .9rem; }
table.list th { color: var(--muted); font-weight: 600; background: #fafbfc; }

/* ---- patient */
.patient-head { display: flex; gap: 1.2rem; align-items: baseline; flex-wrap: wrap; }
.patient-head .name { font-size: 1.35rem; font-weight: 700; }
.day { margin: 1.2rem 0; }
.day > .head { display: flex; gap: .6rem; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: .25rem; margin-bottom: .6rem; flex-wrap: wrap; }
.day > .head .date { font-weight: 700; }

/* ---- photo page */
.photo-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; }
@media (max-width: 1000px) { .photo-page { grid-template-columns: 1fr; } }
.viewer { background: #111; border-radius: var(--radius); display: grid; place-items: center; min-height: 60vh; }
.viewer img, .viewer video { max-width: 100%; max-height: 82vh; display: block; }
dl.facts { display: grid; grid-template-columns: 8.5rem 1fr; gap: .25rem .6rem; margin: 0; font-size: .9rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.compare figure { margin: 0; background: #111; border-radius: var(--radius); overflow: hidden; }
.compare img { width: 100%; display: block; }
.compare figcaption { color: #eee; padding: .4rem .6rem; font-size: .85rem; }

/* ---- patient picker */
.picker { position: relative; }
.picker .results { position: absolute; z-index: 10; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line);
                   border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.08); max-height: 320px; overflow: auto; }
.picker .results button { display: block; width: 100%; text-align: left; border: none; background: none; padding: .45rem .6rem; cursor: pointer; }
.picker .results button:hover { background: #eef4f8; }

/* ---- review */
.session { margin-bottom: .9rem; }
.session .strip { display: flex; gap: .3rem; overflow-x: auto; margin-top: .5rem; }
.session .strip img { height: 72px; width: 96px; object-fit: cover; border-radius: 4px; background: #e9edf1; flex: none; }

/* ---- login */
.login { max-width: 360px; margin: 12vh auto; }
.login h1 { text-align: center; }

#blazor-error-ui { background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0;
                   padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ---- template forms */
fieldset.tform { border: none; border-top: 1px solid var(--line); margin: .4rem 0 0; padding: .5rem 0 0; display: grid; gap: .55rem; }
fieldset.tform legend { font-weight: 600; font-size: .9rem; padding-right: .4rem; }
fieldset.tform .readonly { color: var(--ink); font-size: .95rem; }
.segmented { display: flex; flex-wrap: wrap; gap: .25rem; }
.segmented button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: .25rem .55rem; cursor: pointer; font-size: .88rem; color: var(--ink); }
.segmented button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.selectbar { position: sticky; bottom: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
             padding: .6rem .8rem; margin-top: 1rem; box-shadow: 0 -4px 14px rgba(0,0,0,.06); }

/* sensitive photos: a placeholder in lists, a banner on the photo page */
.sensitive-thumb { width: 100%; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #eef0f3, #eef0f3 10px, #e4e7eb 10px, #e4e7eb 20px); color: #4a5563; font-weight: 600;
  text-decoration: none; gap: .2rem; }
.notice.sensitive { background: #fff6e5; border-color: #e7b04a; }
.lesions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.lesion-card { display: flex; gap: .6rem; align-items: center; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); text-decoration: none; color: inherit; }
.lesion-card img, .lesion-card .sensitive-thumb, .lesion-card .nophoto { width: 72px; height: 54px; aspect-ratio: auto; object-fit: cover; border-radius: 4px;
  background: #e9edf1; font-size: .65rem; flex: none; display: flex; align-items: center; justify-content: center; }
.lesion-card .name { font-weight: 600; }
.disabled-links a { pointer-events: none; opacity: .45; }
.login .ms-signin { display: block; text-align: center; padding: .7rem; font-size: 1.05rem; margin-bottom: .3rem; }
.login details { margin: .8rem 0; }
.login details > summary { cursor: pointer; color: var(--muted); }
