:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --text: #1d2433;
  --muted: #647086;
  --border: #d9dee8;
  --accent: #0f7a6c;
  --accent-soft: #e2f3f0;
  --blue: #2f5bea;
  --blue-soft: #e8eefe;
  --ok: #16865a;
  --ok-soft: #e3f5ec;
  --warn: #a85b00;
  --warn-soft: #fff1de;
  --bad: #c0362c;
  --bad-soft: #fde8e6;
  --gray-soft: #eef0f4;
  --input-bg: #fffdf2;
  --radius: 10px;
}

* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.error-text { color: var(--bad); font-size: 13px; margin: 4px 0 0; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.login-as { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.login-as select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font: inherit; font-size: 13px; background: var(--panel); color: var(--text); max-width: 280px; }

.bell-wrap { position: relative; }
.bell { position: relative; font-size: 18px; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 4px 9px; cursor: pointer; }
.bell span { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 6px; }
.bell-panel {
  position: absolute; right: 0; top: 40px; width: 360px; max-height: 440px; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.bell-panel .bp-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; }
.bell-panel .bp-head button { font-size: 12px; border: 0; background: none; color: var(--blue); cursor: pointer; }
.notif { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; cursor: pointer; font: inherit; color: var(--text); }
.notif.unread { background: var(--blue-soft); }
.notif small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.notif:hover { background: var(--gray-soft); }
.bp-empty { padding: 20px; text-align: center; color: var(--muted); }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 100px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }

/* ---------- buttons ---------- */
.btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.btn:hover:not(:disabled) { background: var(--gray-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.approve { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.approve:hover { filter: brightness(1.08); background: var(--ok); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); background: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--blue); padding: 4px 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
th { background: var(--gray-soft); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--blue-soft); }
.empty-row { text-align: center; color: var(--muted); padding: 24px; }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.s-draft { background: var(--gray-soft); color: var(--muted); }
.s-pending { background: var(--warn-soft); color: var(--warn); }
.s-approved { background: var(--ok-soft); color: var(--ok); }
.s-disapproved { background: var(--bad-soft); color: var(--bad); }
.hr-tag { font-size: 10.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 1px 6px; }

/* ---------- form (paper) ---------- */
.paper { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.paper-title { text-align: center; font-size: 20px; letter-spacing: .08em; font-weight: 800; margin-bottom: 4px; }
.paper-sub { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.route { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 18px; }
.route .rstep { font-size: 12px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); background: var(--panel); }
.route .rstep.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.route .rstep.current { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); font-weight: 700; }
.route .rstep.rejected { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.route .arrow { color: var(--muted); align-self: center; }

.banner { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; }
.banner.view { background: var(--gray-soft); color: var(--muted); }
.banner.turn { background: var(--warn-soft); color: var(--warn); }
.banner.edit { background: var(--blue-soft); color: var(--blue); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.good { background: var(--ok-soft); color: var(--ok); }
.errors { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 10px 14px 10px 30px; margin: 0 0 14px; font-size: 13px; }

.section { margin-bottom: 20px; }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); border-bottom: 2px solid var(--accent-soft); padding-bottom: 4px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 10px 16px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }
.field label, .field .lbl { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 3px; }
.field .req { color: var(--bad); }

input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.invalid { border-color: var(--bad) !important; background: var(--bad-soft) !important; }
.ro { display: block; min-height: 34px; padding: 7px 9px; border-bottom: 1px dashed var(--border); }
.ro.empty { color: var(--muted); }
td .ro { border: 0; padding: 0; min-height: 0; }
.note { font-size: 13px; color: var(--muted); font-style: italic; margin: 0 0 10px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.check input { margin-top: 3px; width: 16px; height: 16px; }

.exp th { white-space: nowrap; }
.exp td { padding: 4px; }
.exp td input, .exp td select { padding: 5px 6px; font-size: 13px; }
.exp td.hrcol { background: #f6fbfa; }
.exp .col-date { width: 130px; }
.exp .col-total { width: 120px; }
.exp .col-type { width: 150px; }
.exp tfoot td { font-weight: 700; background: var(--gray-soft); }
.exp tfoot td.big { font-size: 15px; }
.row-del { border: 0; background: none; color: var(--bad); cursor: pointer; font-size: 16px; padding: 2px 6px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.cert { background: var(--gray-soft); border-radius: 8px; padding: 12px; font-size: 13px; }
.signs td:first-child { font-weight: 700; font-size: 12px; }
.signs .grp { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.sig-approved { color: var(--ok); font-weight: 700; }
.sig-disapproved { color: var(--bad); font-weight: 700; }
.sig-pending { color: var(--warn); font-weight: 700; }
.bal td input { text-align: right; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--panel); border-top: 1px solid var(--border);
  padding: 10px 16px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.actionbar .spacer { flex: 1; max-width: 400px; }

.log-list td:first-child { white-space: nowrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { width: auto; min-width: 180px; background: var(--panel); }

/* dialog + toast */
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: min(440px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-top: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media print {
  .topbar, .actionbar, .no-print, .toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .paper { border: 0; padding: 0; }
  body { background: #fff; }
}
input.money { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- auth ---------- */
body.auth .topbar { display: none; }
.whoami { text-decoration: none; color: var(--text); text-align: right; line-height: 1.2; font-size: 13px; }
.whoami small { display: block; color: var(--muted); font-size: 11.5px; }
.auth-wrap { min-height: calc(100vh - 60px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px 0; }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.auth-card h1 { font-size: 19px; margin-bottom: 4px; }
.auth-card > p { margin: 0 0 16px; }
.auth-card label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.auth-card label input { margin-top: 4px; background: var(--panel); }
.auth-logo { width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 30px; font-weight: 700; display: grid; place-items: center; margin-bottom: 14px; }
.btn.block { display: block; width: 100%; text-align: center; margin-top: 6px; text-decoration: none; }
.small { font-size: 12.5px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-top: 2px; border: 0; background: none; color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-card.demo { padding: 14px 20px; box-shadow: none; }
.auth-card.demo summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.auth-card.demo table { font-size: 12px; margin-top: 6px; }
code { background: var(--gray-soft); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
td.actions { white-space: nowrap; }
td.actions .btn { margin: 1px 0; }
.btn.danger-outline { color: var(--bad); border-color: var(--bad); }
.mail-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.mail-body { white-space: pre-wrap; background: var(--gray-soft); border-radius: 8px; padding: 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; margin: 10px 0; }
.gsi-button { display: flex; justify-content: center; min-height: 44px; align-items: center; margin: 6px 0 4px; }
.center { text-align: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
a.whoami:not([href]) { cursor: default; }
.auth-card.wide { width: min(480px, 100%); }
.auth-card .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .auth-card .two { grid-template-columns: 1fr; } }
.auth-card .req { color: var(--bad); }
.auth-card .errors { margin-bottom: 12px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.auth-links .btn { text-decoration: none; }
.auth-card label select { margin-top: 4px; background: var(--panel); }
.summary-table { margin: 6px 0 12px; }
.summary-table th { width: 38%; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.summary-table td { font-weight: 600; }
.summary-actions { display: flex; justify-content: space-between; gap: 8px; }
.summary-actions .btn { flex: 1; }
.summary-table td { overflow-wrap: anywhere; }
/* Password fields that are plain text inputs, so the browser doesn't offer to generate/save passwords */
input.masked { -webkit-text-security: disc; text-security: disc; font-family: text-security-disc, system-ui, sans-serif; letter-spacing: .08em; }
.card.issued { border-color: var(--ok); background: var(--ok-soft); }
.big-code { font-size: 15px; font-weight: 700; padding: 3px 8px; user-select: all; }
.field input:disabled { background: var(--gray-soft); color: var(--muted); cursor: not-allowed; }
.section-title .add-row { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.section-title .add-row { white-space: nowrap; flex-shrink: 0; }

/* ---------- pop-up message (centered modal, blurred background) ---------- */
.toast-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 23, 42, .28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: toastFade .2s ease-out;
}
.toast-overlay[hidden] { display: none; }
.toast-overlay.closing { animation: toastFadeOut .18s ease-in forwards; }
.toast-overlay.closing .toast-modal { animation: toastOut .18s ease-in forwards; }
.toast-modal {
  position: relative; overflow: hidden; width: min(360px, 100%); text-align: center;
  background: var(--panel); border-radius: 18px; padding: 28px 26px 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28); animation: toastPop .38s cubic-bezier(.2, 1.4, .4, 1);
}
.toast-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); animation: toastIcon .5s .08s cubic-bezier(.2, 1.6, .4, 1) both;
}
.toast-icon.info { background: var(--blue-soft); color: var(--blue); }
.toast-icon.warn { background: var(--warn-soft); color: var(--warn); }
.toast-icon svg { width: 34px; height: 34px; }
.toast-icon svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: toastDraw .45s .3s ease-out forwards; }
.toast-text { margin: 0 0 18px; font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.4; }
.toast-modal .btn { min-width: 120px; }
@keyframes toastFade { from { opacity: 0; } }
@keyframes toastFadeOut { to { opacity: 0; } }
@keyframes toastPop { from { opacity: 0; transform: scale(.85) translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: scale(.92); } }
@keyframes toastIcon { from { transform: scale(0); } }
@keyframes toastDraw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .toast-overlay, .toast-modal, .toast-icon, .toast-icon svg path { animation: none !important; stroke-dashoffset: 0; }
}

/* ---------- top menu links ---------- */
.nav { display: flex; gap: 6px; }
.nav a {
  position: relative; text-decoration: none; color: var(--muted); font-weight: 600;
  padding: 8px 14px; border-radius: 8px;
  transition: color .2s ease, background-color .2s ease, transform .2s ease;
}
.nav a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: center; transition: transform .25s ease;
}
.nav a:hover { color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }
.nav a:active { transform: translateY(0); }
.nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.brand .logo { transition: transform .2s ease, box-shadow .2s ease; }
.brand:hover .logo { transform: scale(1.06); box-shadow: 0 4px 12px rgba(15, 122, 108, .3); }
@media (prefers-reduced-motion: reduce) { .nav a, .nav a::after, .brand .logo { transition: none; } }
.toast-icon.error { background: var(--bad-soft); color: var(--bad); animation: toastIcon .5s .08s cubic-bezier(.2, 1.6, .4, 1) both, toastShake .45s .55s ease-in-out; }
.toast-overlay[data-kind="error"] .toast-modal { width: min(440px, 100%); }
.toast-overlay[data-kind="error"] .toast-text { margin-bottom: 12px; }
.toast-list {
  text-align: left; margin: 0 0 18px; padding: 12px 14px 12px 32px; max-height: 45vh; overflow: auto;
  background: var(--bad-soft); color: var(--bad); border-radius: 10px; font-size: 13.5px; line-height: 1.55;
}
.toast-list li { animation: toastItem .3s ease-out both; }
.toast-list li:nth-child(2) { animation-delay: .04s; } .toast-list li:nth-child(3) { animation-delay: .08s; }
.toast-list li:nth-child(4) { animation-delay: .12s; } .toast-list li:nth-child(5) { animation-delay: .16s; }
.toast-list li:nth-child(n+6) { animation-delay: .2s; }
@keyframes toastShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes toastItem { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .toast-list li { animation: none; } }
.paper-title { margin-bottom: 18px; }
.paper-title { margin-bottom: 6px; }
.form-subnote {
  max-width: 640px; margin: 0 auto 18px; text-align: center;
  font-size: 12.5px; line-height: 1.5; color: var(--warn);
  background: var(--warn-soft); border-radius: 8px; padding: 6px 12px;
}
.form-subnote span { font-weight: 700; margin-right: 2px; }
.paper-title { font-size: 28px; letter-spacing: .1em; }
@media (max-width: 520px) { .paper-title { font-size: 22px; } }
.paper-title { color: var(--accent); }
.banner.edit { background: #f4f7fe; color: #33415c; border: 1px solid #dbe3f7; border-left: 4px solid var(--blue); font-size: 13.5px; }
.banner.edit b { color: var(--blue); }
.banner .req { color: var(--bad); font-weight: 700; }

/* ---------- top-right controls: same hover as the menu links ---------- */
.top-right .bell, .top-right .whoami, .top-right #logoutBtn {
  position: relative; transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.top-right .whoami { padding: 6px 12px; border-radius: 8px; }
.top-right .whoami::after, .top-right #logoutBtn::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: center; transition: transform .25s ease;
}
.top-right .bell:hover, .top-right .whoami:hover, .top-right #logoutBtn:hover {
  background: var(--accent-soft); border-color: transparent; transform: translateY(-1px);
}
.top-right .whoami:hover, .top-right .whoami:hover small, .top-right #logoutBtn:hover { color: var(--accent); }
.top-right .whoami:hover::after, .top-right #logoutBtn:hover::after { transform: scaleX(1); }
.top-right .bell:hover { box-shadow: 0 0 0 1px var(--accent-soft); }
.top-right .bell:hover { animation: bellRing .5s ease; }
.top-right .bell:active, .top-right .whoami:active, .top-right #logoutBtn:active { transform: translateY(0); }
.top-right .bell:focus-visible, .top-right .whoami:focus-visible, .top-right #logoutBtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes bellRing { 0%, 100% { rotate: 0deg; } 25% { rotate: -12deg; } 50% { rotate: 10deg; } 75% { rotate: -6deg; } }
@media (prefers-reduced-motion: reduce) {
  .top-right .bell, .top-right .whoami, .top-right #logoutBtn, .top-right .whoami::after, .top-right #logoutBtn::after { transition: none; }
  .top-right .bell:hover { animation: none; }
}
.confirm-title { margin: 0 0 6px; font-size: 18px; }
.confirm-text { margin: 0 0 20px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; padding: 10px 14px; }
dialog { border: 0; border-radius: 18px; padding: 26px; box-shadow: 0 24px 60px rgba(15, 23, 42, .28); }
dialog[open] { animation: toastPop .38s cubic-bezier(.2, 1.4, .4, 1); }
dialog::backdrop { background: rgba(15, 23, 42, .28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* ---------- welcome pop-up ---------- */
.toast-icon.welcome { background: linear-gradient(135deg, var(--accent-soft), #fff4dc); font-size: 32px; }
.toast-icon .wave { display: inline-block; transform-origin: 70% 80%; animation: wave 1.4s .4s ease-in-out 2; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } }
.toast-overlay[data-kind="welcome"] .toast-modal { width: min(420px, 100%); }
.toast-overlay[data-kind="welcome"] .toast-text { font-size: 20px; font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.toast-sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.toast-details { list-style: none; margin: 0 0 20px; padding: 0; text-align: left; display: grid; gap: 8px; }
.toast-details li {
  display: flex; gap: 10px; align-items: flex-start; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; font-size: 13.5px; line-height: 1.45; animation: toastItem .3s ease-out both;
}
.toast-details li:nth-child(2) { animation-delay: .06s; } .toast-details li:nth-child(3) { animation-delay: .12s; } .toast-details li:nth-child(4) { animation-delay: .18s; }
.toast-details .td-icon { flex-shrink: 0; width: 20px; text-align: center; color: var(--accent); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .toast-icon .wave, .toast-details li { animation: none; } }

/* ---------- top-right links: Med Form · My Profile ---------- */
.top-right { gap: 6px; }
.top-right .toplink {
  position: relative; display: inline-block; text-decoration: none; color: var(--muted); font-weight: 600;
  padding: 8px 14px; border-radius: 8px; transition: color .2s ease, background-color .2s ease, transform .2s ease;
}
.top-right .toplink[hidden] { display: none; }
.top-right .toplink::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: center; transition: transform .25s ease;
}
.top-right .toplink:hover { color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.top-right .toplink:hover::after, .top-right .toplink.active::after { transform: scaleX(1); }
.top-right .toplink.active { color: var(--accent); background: var(--accent-soft); }
.top-right .toplink:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top-right #logoutBtn { margin-left: 6px; }
@media (prefers-reduced-motion: reduce) { .top-right .toplink, .top-right .toplink::after { transition: none; } }
