/* Apex clinic system. Workshop palette (setup/08 s9, 3 Oct 2026): orange buttons
   carry graphite text, never white; tracker colours are the shared set. */
:root {
  --orange: #EF7A1E; --orange-text: #A84A00; --graphite: #22272B; --concrete: #EDEFF0;
  --steel: #5B636A; --line: #D3D8DB; --white: #fff; --pine: #1D4A3A;
  --green: #1B6B3A; --green-bg: #E3F2E8; --amber: #6E4E00; --amber-bg: #FFF3C4;
  --red: #A3241C; --red-bg: #FBE3E0;
  --hour: 64px;               /* diary: height of one hour */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       color: var(--graphite); background: var(--concrete); }
a { color: var(--orange-text); }
h1 { font-size: 1.35rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
small, .muted { color: var(--steel); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }

/* top bar */
.top { background: var(--graphite); color: var(--white); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 4px; padding-bottom: 0; min-height: 48px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--orange); text-decoration: none; margin-right: 12px; letter-spacing: .02em; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.top nav a { color: #dfe3e6; text-decoration: none; padding: 12px 10px; border-bottom: 3px solid transparent; }
.top nav a.on { color: var(--white); border-bottom-color: var(--orange); }
.top .who { color: #b9c0c5; font-size: .85rem; display: flex; gap: 8px; align-items: center; }
.top .who button { background: none; border: 1px solid #555d63; color: #dfe3e6; padding: 3px 8px; border-radius: 4px; cursor: pointer; }
.testbar { background: var(--amber-bg); color: var(--amber); text-align: center; font-size: .85rem; padding: 4px; }

/* panels, tables, forms */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 12px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--steel); font-weight: 600; }
.scroll { overflow-x: auto; }
label { display: block; font-size: .85rem; color: var(--steel); margin: 8px 0 2px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number],
input[type=password], input[type=search], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
textarea { min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 140px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; color: var(--graphite); font-size: .95rem; }
.check input { width: auto; }
.btn, button.btn { display: inline-block; background: var(--orange); color: var(--graphite); border: 0; border-radius: 6px;
       padding: 9px 14px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.plain { background: var(--white); border: 1px solid var(--line); font-weight: 500; }
.btn.small { padding: 4px 9px; font-size: .85rem; }
.btn.danger { background: var(--red-bg); color: var(--red); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.inline { display: inline; }
.tight { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tight input[type=time] { width: auto; padding: 5px 6px; }
.tight input[type=text] { padding: 5px 8px; }

/* messages and badges */
.flash { padding: 10px 14px; border-radius: 6px; margin: 10px 0; background: var(--white); border-left: 4px solid var(--steel); }
.flash.error { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.flash.warn { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.flash.ok { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .78rem; font-weight: 600;
         background: var(--concrete); color: var(--steel); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.alert { background: var(--red-bg); color: var(--red); border-radius: 6px; padding: 8px 12px; margin: 8px 0; font-weight: 600; }
.labels { display: flex; gap: 6px; flex-wrap: wrap; }

/* the diary */
.daynav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.daynav h1 { margin: 0 8px 0 0; }
.daynav form { display: flex; gap: 6px; }
.diary { display: grid; background: var(--white); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.diary .head { background: var(--white); padding: 8px 6px; font-weight: 600;
               border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font-size: .9rem; min-width: 150px; }
.diary .head small { display: block; font-weight: 400; }
.diary .times { position: relative; border-right: 1px solid var(--line); width: 52px; }
.diary .times div { position: absolute; right: 6px; font-size: .75rem; color: var(--steel); transform: translateY(-50%); }
.diary .times div:first-child { transform: none; }
.diary .col { position: relative; border-left: 1px solid var(--line); min-width: 150px;
              background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour)); }
.diary .off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #f1f3f4, #f1f3f4 6px, #e6e9eb 6px, #e6e9eb 12px); }
.diary .free { position: absolute; left: 0; right: 0; display: block; text-decoration: none; }
.diary .free:hover { background: rgba(239, 122, 30, .12); }
.diary .appt, .diary .block { position: absolute; left: 3px; right: 3px; border-radius: 5px; padding: 3px 6px; font-size: .8rem;
              overflow: hidden; text-decoration: none; color: var(--graphite); line-height: 1.25; }
.diary .appt { background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--steel); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.diary .appt b { display: block; }
.diary .appt.cancelled { opacity: .45; text-decoration: line-through; }
.diary .appt.dna { background: var(--red-bg); }
.diary .appt.completed { background: #f6faf7; }
.diary .appt.arrived { background: var(--amber-bg); }
.diary .appt.problem { outline: 2px dashed var(--amber); outline-offset: -2px; }
.diary .appt.alerted::after { content: "!"; position: absolute; top: 2px; right: 5px; color: var(--red); font-weight: 800; }
.diary .block { background: #e9ecee; color: var(--steel); border: 1px dashed #c6ccd0; }
.diary .now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 3; }
.tankbar { margin: 8px 0; }

/* slots */
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.slotperson { font-weight: 600; margin: 10px 0 6px; border-left: 5px solid var(--steel); padding-left: 8px; }
.slots form button { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; font: inherit; text-align: left; }
.slots form button:hover { border-color: var(--orange); }
.slots small { display: block; }

/* tracker */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.board .lane { border-radius: 8px; padding: 10px; }
.board .lane.red { background: var(--red-bg); } .board .lane.amber { background: var(--amber-bg); } .board .lane.green { background: var(--green-bg); }
.board .card { background: var(--white); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }

.note-text { white-space: pre-wrap; font-family: inherit; background: var(--concrete); padding: 10px; border-radius: 6px; margin: 6px 0; }
.kv td:first-child { color: var(--steel); width: 38%; }

/* protocols */
.draftbar { position: sticky; top: 48px; z-index: 10; background: var(--amber-bg); color: var(--amber); border: 2px solid var(--amber);
            border-radius: 6px; padding: 8px 12px; margin: 10px 0; font-weight: 700; }
.doc { line-height: 1.55; overflow-wrap: break-word; }
.doc td, .doc th { min-width: 7em; }
.doc h1 { font-size: 1.4rem; } .doc h2 { font-size: 1.2rem; border-top: 1px solid var(--line); padding-top: 14px; }
.doc table { display: block; overflow-x: auto; font-size: .9rem; margin: 10px 0; }
.doc th { text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--graphite); background: var(--concrete); }
.doc blockquote { margin: 10px 0; padding: 6px 12px; border-left: 4px solid var(--line); color: var(--steel); }
.doc code { background: var(--concrete); padding: 0 4px; border-radius: 3px; }
:target { scroll-margin-top: 110px; }

@media (max-width: 640px) {
  .top .wrap { flex-wrap: nowrap; }
  .top nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .top nav a { padding: 12px 8px; white-space: nowrap; }
  .top .who > a { display: none; }
  .brand { margin-right: 6px; }
  .diary .head, .diary .col { min-width: 132px; }
}
@media print {
  .top, .actions, .daynav form, .no-print { display: none !important; }
  .draftbar { position: static; }
  body { background: var(--white); }
  .panel { border: 0; }
}
