/* AllSafe Medical Group Portal — dark only (matches the inventory app) */
:root {
  --bg: #111111;
  --nav: #161616;
  --card: #1e1e1e;
  --card-2: #252525;
  --input: #252525;
  --line: #2e2e2e;
  --line-2: #3a3a3a;
  --ink: #e8e8e8;
  --ink-2: #c4c7cc;
  --muted: #9ca3af;
  --green: #7dc926;
  --green-2: #8fd62f;
  --green-soft: #1a2e0a;
  --green-line: #2c4a12;
  --on-green: #0d1a03;
  --red: #f2756a;
  --red-soft: #331614;
  --red-line: #5a2622;
  --amber: #f2b552;
  --amber-soft: #2e230e;
  --amber-line: #4d3a14;
  --blue: #8fb4f5;
  --blue-soft: #16213a;
  --blue-line: #253a63;
  --focus: rgba(125, 201, 38, .35);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 14px 40px -12px rgba(0, 0, 0, .75);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
  background-image: radial-gradient(1200px 500px at 50% -200px, rgba(125, 201, 38, .07), transparent 70%);
  background-repeat: no-repeat;
}
a { color: var(--green); }
a:hover { color: var(--green-2); }
h1 { font-size: 1.6rem; margin: 0 0 .35rem; color: var(--ink); line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; color: var(--ink); }
h3 { font-size: 1rem; margin: 0 0 .5rem; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
code { background: #2a2a2a; color: var(--green); padding: 1px 6px; border-radius: 5px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(125, 201, 38, .35); color: #fff; }

/* top bar */
.topbar {
  background: rgba(22, 22, 22, .88);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--green); color: var(--on-green); box-shadow: 0 6px 18px -6px rgba(125, 201, 38, .55); }
.brand-mark svg { stroke: var(--on-green); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1rem; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 7px 12px; border-radius: 9px; font-size: .92rem; font-weight: 500; }
.nav a:hover { background: var(--card); color: var(--ink); }
.nav a.active { background: var(--green-soft); color: var(--green); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who form { margin: 0; }
.who-name { color: var(--ink-2); font-size: .9rem; }

/* layout */
.wrap { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 20px 48px; }
.foot { text-align: center; color: #6b7280; font-size: .8rem; padding: 18px 16px 26px; border-top: 1px solid var(--line); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); margin-bottom: 18px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0));
}
.card.narrow {
  max-width: 420px; margin: 56px auto; padding: 32px 30px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(125, 201, 38, .06);
  position: relative; overflow: hidden;
}
.card.narrow::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
}
.card.narrow h1 { font-size: 1.75rem; margin-bottom: .25rem; }
.card.narrow > p.muted:first-of-type { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.hero { margin: 4px 0 22px; }
.hero h1 { font-size: 1.9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.help { margin-top: 18px; text-align: center; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile {
  position: relative; display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0));
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tile:hover, .tile:focus-visible {
  color: var(--ink); border-color: var(--green-line); transform: translateY(-2px); outline: none;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(125, 201, 38, .25);
}
.tile-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }
.tile-icon svg { stroke: var(--green); }
.tile-icon.big { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; }
.tile-icon.sm { width: 34px; height: 34px; border-radius: 10px; }
.tile-body { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.tile-name { font-weight: 600; color: var(--ink); font-size: 1.04rem; }
.tile-desc { color: var(--muted); font-size: .88rem; }
.tile-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--ink); width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--input); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #6b7280; }
select {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--focus); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }
.code-input { font-size: 1.7rem; letter-spacing: .45em; text-align: center; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 14px !important; }
.field-hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--card-2); color: var(--ink);
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { border-color: #555; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--green); border-color: var(--green); color: var(--on-green);
  box-shadow: 0 6px 18px -6px rgba(125, 201, 38, .5);
}
.btn-primary:hover { background: var(--green-2); border-color: var(--green-2); color: var(--on-green); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { border-color: #555; color: var(--ink); background: var(--card); }
.btn-sm { padding: 6px 11px; font-size: .85rem; }
.btn-block { width: 100%; padding: 12px 16px; }
.linklike { background: none; border: 0; padding: 0; color: var(--green); font: inherit; cursor: pointer; text-decoration: none; }
.linklike:hover { text-decoration: underline; color: var(--green-2); }
form.inline { display: inline; margin: 0; }

/* alerts & pills */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; border: 1px solid transparent; font-size: .93rem; }
.alert-success { background: var(--green-soft); border-color: var(--green-line); color: var(--green-2); }
.alert-error { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.alert-info { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.alert-warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #2a2a2a; color: var(--ink-2); white-space: nowrap; border: 1px solid var(--line-2); }
.pill-green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.pill-red { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.pill-navy { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--card-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(125, 201, 38, .04); }
td .sub { display: block; color: var(--muted); font-size: .82rem; }
tr.dim td { opacity: .5; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 180px; }
.app-cell { display: flex; align-items: center; gap: 10px; }

/* access matrix */
.access-row { display: grid; grid-template-columns: 26px 1fr 170px; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.access-row:last-child { border-bottom: 0; }
.access-row .app-cell span { font-weight: 600; color: var(--ink); }

.keybox { background: #0b0b0b; color: #b9e98a; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 13px 15px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; white-space: pre-wrap; word-break: break-all; }
.beacons { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 1.6rem; color: var(--green); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats .card { margin: 0; padding: 14px 16px; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #161616; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

@media (max-width: 720px) {
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; }
  .access-row { grid-template-columns: 26px 1fr; }
  .access-row select { grid-column: 2; }
  .card.narrow { margin: 20px auto; padding: 26px 20px; }
  .wrap { padding: 20px 16px 40px; }
}
.mt { margin-top: 14px; }
.m0 { margin: 0; }

/* ================= Sign-in page (two panels, animated tiles) ================= */
body.bare { background: #0c0d0f; background-image: radial-gradient(900px 600px at 0% 0%, rgba(125, 201, 38, .08), transparent 60%), radial-gradient(800px 500px at 100% 100%, rgba(59, 90, 168, .10), transparent 60%); }
body.bare .foot { display: none; }
.wrap-bare { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 32px 20px; }
.auth-shell {
  width: 100%; max-width: 860px; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 22px; padding: 18px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(125, 201, 38, .05);
}
.auth-art {
  border-radius: 14px; padding: 34px 26px 30px; display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(120% 70% at 20% 0%, rgba(125, 201, 38, .10), transparent 60%), linear-gradient(180deg, #171a17, #0e0f10);
  border: 1px solid var(--line); overflow: hidden;
}
.auth-logo {
  width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  border: 4px solid var(--green); background: #0c0c0c;
  box-shadow: 0 0 0 6px rgba(125, 201, 38, .08), 0 0 34px rgba(125, 201, 38, .35);
  animation: logo-glow 4s ease-in-out infinite;
}
.auth-logo img { width: 86%; height: 86%; object-fit: contain; }
.auth-logo-text { font: 600 21px/1 Georgia, "Times New Roman", serif; color: #c9cdd3; letter-spacing: .02em; }
.auth-logo-text b { color: var(--green); font-weight: 600; }
@keyframes logo-glow { 0%, 100% { box-shadow: 0 0 0 6px rgba(125, 201, 38, .08), 0 0 24px rgba(125, 201, 38, .25); } 50% { box-shadow: 0 0 0 9px rgba(125, 201, 38, .12), 0 0 44px rgba(125, 201, 38, .5); } }
.auth-org { margin: 16px 0 0; font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.auth-sub { margin: 2px 0 22px; font-size: .82rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

.tile-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; width: 100%; max-width: 300px; }
.tg {
  aspect-ratio: 1; border-radius: 7px; background: var(--tg);
  animation: tg-cycle 7s ease-in-out infinite, tg-wave 2.8s ease-in-out infinite;
  animation-delay: calc(var(--o) * -1s), calc((var(--r) + var(--c)) * .12s);
  will-change: transform, filter;
}
.tg-g { --tg: #2f8a57; } .tg-a { --tg: #8c6c1e; } .tg-b { --tg: #3a59a6; } .tg-d { --tg: #262a33; } .tg-l { --tg: #7dc926; }
/* Each tile fades through the palette... */
@keyframes tg-cycle {
  0%, 40%  { background: var(--tg); }
  55%      { background: #2f8a57; }
  70%      { background: #3a59a6; }
  85%      { background: #8c6c1e; }
  100%     { background: var(--tg); }
}
/* ...while a wave of light sweeps diagonally across the grid */
@keyframes tg-wave {
  0%, 30%, 70%, 100% { transform: scale(1); filter: brightness(1); box-shadow: none; }
  50%                { transform: scale(1.18); filter: brightness(1.7); box-shadow: 0 0 16px rgba(125, 201, 38, .55); }
}
/* Devices set to reduce motion: no growing tiles, just slow color changes */
@media (prefers-reduced-motion: reduce) {
  .tg { animation: tg-cycle 12s ease-in-out infinite; animation-delay: calc(var(--o) * -1s); }
  .auth-logo { animation: none; }
}

.auth-form { padding: 40px 34px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h1 { font-size: 1.85rem; margin-bottom: .3rem; }
.auth-form > p.muted { margin: 0 0 20px; }
.auth-form .stack { margin-top: 4px; }
.auth-form .help { margin-top: 22px; }
.auth-form .row-between { margin-top: 14px; }
.auth-foot { margin-top: 22px; color: #5d636b; font-size: .8rem; text-align: center; }

@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; padding: 12px; }
  .auth-art { padding: 26px 18px 22px; }
  .tile-grid { max-width: 240px; gap: 6px; }
  .auth-form { padding: 26px 16px 18px; }
}

/* Real logo: it has its own green ring, so drop the drawn border */
.auth-logo.has-img { width: 132px; height: 132px; border: 0; background: transparent; overflow: visible; }
.auth-logo.has-img img { width: 100%; height: 100%; }

/* Top bar logo */
.brand-logo { width: 42px; height: 42px; border-radius: 50%; object-fit: contain; flex: none; filter: drop-shadow(0 0 8px rgba(125, 201, 38, .35)); }

/* Tile timing (set by class: the portal's security policy blocks inline styles) */
.tile-grid .r0{--r:0} .tile-grid .r1{--r:1} .tile-grid .r2{--r:2} .tile-grid .r3{--r:3} .tile-grid .r4{--r:4} .tile-grid .r5{--r:5}
.tile-grid .c0{--c:0} .tile-grid .c1{--c:1} .tile-grid .c2{--c:2} .tile-grid .c3{--c:3} .tile-grid .c4{--c:4} .tile-grid .c5{--c:5} .tile-grid .c6{--c:6} .tile-grid .c7{--c:7}
.tile-grid .o0{--o:0.0} .tile-grid .o1{--o:0.8} .tile-grid .o2{--o:1.6} .tile-grid .o3{--o:2.4} .tile-grid .o4{--o:3.2} .tile-grid .o5{--o:4.0} .tile-grid .o6{--o:4.8} .tile-grid .o7{--o:5.6} .tile-grid .o8{--o:6.4} .tile-grid .o9{--o:7.2}
