/* Alpine Care team dashboard */
@font-face { font-family: 'Manrope'; font-weight: 400; font-display: swap; src: url('../assets/fonts/manrope-400.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 600; font-display: swap; src: url('../assets/fonts/manrope-600.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 700; font-display: swap; src: url('../assets/fonts/manrope-700.woff2') format('woff2'); }

:root {
  --snow: #f7f9fb; --ice: #eaf0f6; --white: #fff;
  --navy: #1c3461; --navy-deep: #101f3d; --ink: #22304a;
  --red: #d43d3d; --red-deep: #b52f2f; --muted: #5b6b85; --line: #d8e1ec;
  --green: #2e9e5b; --amber: #b7791f;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--snow); color: var(--ink); font: 400 15px/1.5 'Manrope', -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--navy); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; color: var(--navy-deep); }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .6rem; color: var(--navy-deep); }
h2:first-child { margin-top: 0; }
h3 { font-size: 1rem; margin: 0 0 .35rem; }
p { margin: 0 0 .5rem; }
code { font-size: 1.05em; background: var(--white); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); user-select: all; }

.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .85rem; }
.note { color: var(--muted); font-size: .9rem; margin-top: 1.25rem; }
.empty { background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; color: var(--muted); }
.warn { color: var(--red-deep); font-weight: 600; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: var(--white); font: 600 .92rem/1 inherit; font-family: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--navy-deep); }
.btn--ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn--ghost:hover { background: var(--ice); }
.btn--danger { background: var(--white); color: var(--red-deep); border-color: #ecc1c1; }
.btn--danger:hover { background: #fbeaea; }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select { font: inherit; color: var(--ink); min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); min-width: 0; }
textarea { font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); min-width: 0; resize: vertical; }
textarea:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.edit { margin-top: 1rem; }
.edit > summary { list-style: none; }
.edit > summary::-webkit-details-marker { display: none; }
.edit[open] > summary { margin-bottom: 12px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); }
label.check input { min-height: 0; width: 18px; height: 18px; }

/* Layout */
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 6px rgba(16, 31, 61, .04); margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row form { margin: 0; }
.wrapfields > label { flex: 1 1 160px; }
.full { flex-basis: 100%; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.stack .btn { align-self: flex-start; }
.narrow { max-width: 420px; }
.inline { display: inline-flex; gap: 6px; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin: 0; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 10px 16px; background: var(--navy-deep); color: var(--white); }
.top__brand { display: flex; align-items: center; gap: 8px; color: var(--white); font-weight: 700; text-decoration: none; }
.top__brand img { width: 28px; height: 28px; object-fit: contain; }
.top__nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.top__nav a { color: #c9d4e6; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .92rem; }
.top__nav a:hover { background: rgba(255, 255, 255, .08); color: var(--white); }
.top__nav a.on { background: rgba(255, 255, 255, .14); color: var(--white); }
.top__out { margin: 0; }
.top__out .btn { min-height: 34px; }
.count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--red); color: var(--white); font-size: .78rem; text-align: center; }

.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.bar h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bar__tools { display: flex; flex-wrap: wrap; gap: 6px; }

/* Flash messages */
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash--ok { background: #ebf7f0; border-color: #b9e2c9; color: #1d5e37; }
.flash--err { background: #fbeaea; border-color: #ecc1c1; color: var(--red-deep); }
.flash--warn { background: #fdf4e3; border-color: #f0d9a8; color: #7a5212; }

/* Status badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 700; vertical-align: middle; }
.badge--pending { background: #fdf4e3; color: #7a5212; }
.badge--confirmed { background: #ebf7f0; color: #1d5e37; }
.badge--declined, .badge--cancelled { background: var(--ice); color: var(--muted); }

/* Day columns */
.cols { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 14px; }
.col { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.col h2 { margin: 0 0 10px; display: flex; flex-direction: column; gap: 2px; }
.col h2 .muted { font-size: .8rem; }
.slotcard { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; border-left: 4px solid var(--navy); background: var(--snow); color: var(--ink); text-decoration: none; }
a.slotcard:hover { background: var(--ice); }
.slotcard .badge { align-self: flex-start; margin-top: 4px; }
.slotcard--pending { border-left-color: var(--amber); }
.slotcard--confirmed { border-left-color: var(--green); }
.slotcard--block { border-left-color: var(--muted); background: repeating-linear-gradient(135deg, var(--snow) 0 8px, var(--ice) 8px 16px); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .8rem; color: var(--muted); background: var(--snow); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.off td { opacity: .5; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 8px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .85rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Therapist diary */
.dayhead { margin-top: 1.5rem; }
.mine { display: flex; gap: 16px; }
.mine__time { font-weight: 700; font-size: 1.2rem; color: var(--navy-deep); min-width: 64px; display: flex; flex-direction: column; }
.mine__time span { font-size: .85rem; color: var(--muted); font-weight: 400; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login__card h1 { margin: 0; }
.login__card--wide { max-width: 460px; }
.login__card p { margin: 0; }
.steps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 10px; }
.qr { margin: 10px 0; }
.qr svg { display: block; width: 200px; height: 200px; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.key { display: inline-block; margin-top: 4px; letter-spacing: .04em; word-break: break-all; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--navy); font: inherit; text-decoration: underline; cursor: pointer; }
.codes ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.codes code { font-size: 1.05rem; letter-spacing: .05em; }
.login__logo { width: 48px; height: 48px; object-fit: contain; }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tbl td { border: 0; padding: 4px 12px; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dd { margin-bottom: 8px; }
  .top__nav { order: 3; flex-basis: 100%; }
}
