/* ===== WelcomeDesk — modern UI ===== */
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --border: #e7e8ec;
  --border-strong: #d4d6dd;
  --text: #15171c;
  --muted: #6b7180;
  --muted-2: #9aa0ad;
  --green: #15a34a;
  --green-soft: #e7f7ed;
  --amber: #d97706;
  --amber-soft: #fdf3e2;
  --red: #e0413a;
  --red-soft: #fdeceb;
  --blue-soft: #e8efff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16,18,28,.06), 0 1px 1px rgba(16,18,28,.04);
  --shadow: 0 4px 14px rgba(16,18,28,.07), 0 1px 3px rgba(16,18,28,.05);
  --shadow-lg: 0 18px 48px rgba(16,18,28,.16);
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 23px; letter-spacing: -.02em; }
h2 { font-size: 18px; letter-spacing: -.01em; }
h3 { font-size: 15px; letter-spacing: -.01em; }
img { max-width: 100%; display: block; }

/* ===== App shell ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; background: #0f1118; color: #aeb4c2; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 16px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  font-size: 19px; font-weight: 700; color: #fff; padding: 8px 22px 16px;
  letter-spacing: -.02em; display: flex; align-items: center; gap: 8px;
}
.sidebar .brand .dot { width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 4px rgba(79,70,229,.25); }
.sidebar .brand span { color: #818cf8; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; color: #aeb4c2;
  padding: 9px 22px; font-size: 13.5px; font-weight: 500; border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #181b25; color: #fff; text-decoration: none; }
.sidebar nav a.active { background: #181b25; color: #fff; border-left-color: var(--brand); }
.sidebar nav a .ico { width: 16px; text-align: center; opacity: .85; }
.sidebar .nav-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: #565d6e; padding: 18px 22px 6px; font-weight: 700;
}
.sidebar .spacer { flex: 1; }
.sidebar .org-box { padding: 14px 22px 4px; border-top: 1px solid #1d212c; font-size: 13px; margin-top: 8px; }
.sidebar .org-box .name { color: #fff; font-weight: 600; }
.sidebar .org-box .plan {
  color: #565d6e; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 13px 30px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar strong { font-size: 15px; letter-spacing: -.01em; }
.topbar .user { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.content { padding: 26px 30px 60px; max-width: 1240px; width: 100%; }

.menu-toggle { display: none; background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--text); line-height: 1; padding: 4px 8px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head p.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Cards ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h3 { margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h3 { margin-bottom: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Stat tiles ===== */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px 19px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; }
.stat .value { font-size: 31px; font-weight: 700; margin-top: 5px; letter-spacing: -.03em; }
.stat .value.alert { color: var(--red); }
.stat .value.ok { color: var(--green); }
.stat .foot { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.stat .spark { position: absolute; right: 14px; top: 16px; font-size: 18px; opacity: .25; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .045em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 700; }
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
.table-empty { padding: 40px; text-align: center; color: var(--muted); }
.table-empty .big { font-size: 30px; margin-bottom: 6px; opacity: .5; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 9px 15px; border-radius: var(--radius-sm); font-size: 13.5px; cursor: pointer;
  font-weight: 600; text-decoration: none; font-family: inherit; transition: all .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark);
  text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #c4322c; border-color: #c4322c; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.lg { padding: 14px 26px; font-size: 16px; border-radius: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Forms ===== */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text); transition: border .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
input[type=color] { padding: 4px; height: 44px; }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; min-height: 88px; }
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check-line input { width: auto; }

/* ===== Pills ===== */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; }
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--green-soft); color: #137a39; }
.pill.amber { background: var(--amber-soft); color: #b45309; }
.pill.red { background: var(--red-soft); color: #be332d; }
.pill.blue { background: var(--blue-soft); color: var(--brand-dark); }
.pill.gray { background: #eef0f3; color: #555b69; }

/* ===== Flash ===== */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 13.5px; display: flex; gap: 9px; align-items: flex-start; }
.flash.success { background: var(--green-soft); color: #11703a; }
.flash.error { background: var(--red-soft); color: #b02f29; }

/* ===== Auth / centered ===== */
.center-page { display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: radial-gradient(900px 500px at 20% -10%, #e9ebff 0%, transparent 60%), var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 34px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-card .brand { font-size: 23px; font-weight: 700; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 8px; }
.auth-card .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 4px rgba(79,70,229,.2); }
.auth-card .brand span { color: var(--brand); }
.auth-card .tag { color: var(--muted); margin: 6px 0 22px; font-size: 14px; }

/* ===== Bar chart ===== */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding-bottom: 20px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, var(--brand), #6f68e8);
  border-radius: 4px 4px 2px 2px; min-height: 3px; position: relative; transition: opacity .12s; }
.bars .bar:hover { opacity: .8; }
.bars .bar span { position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--muted-2); white-space: nowrap; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px;
  box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.tabs a { padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); }
.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--brand); color: #fff; }

/* ===== Avatars / photos ===== */
.vphoto { width: 40px; height: 40px; border-radius: 9px; object-fit: cover;
  background: var(--brand-soft); flex-shrink: 0; }
.vphoto.lg { width: 84px; height: 84px; border-radius: 14px; }
.initials { display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }

/* ===== Misc ===== */
/* ===== Calendar ===== */
.cal { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); }
.cal-head div { padding: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); text-align: center; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 104px; border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  padding: 5px 6px; }
.cal-cell:nth-child(7n+1) { border-left: none; }
.cal-cell.muted-cell { background: var(--surface-2); }
.cal-cell.muted-cell .cal-day { color: var(--muted-2); }
.cal-cell.today { background: var(--brand-soft); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.cal-cell.today .cal-day { color: var(--brand-dark); }
.cal-ev { display: block; font-size: 11.5px; padding: 3px 6px; border-radius: 5px;
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; }
.cal-ev:hover { text-decoration: none; opacity: .88; }
.cal-ev.group { background: var(--brand); color: #fff; }
.cal-ev.invite { background: var(--blue-soft); color: var(--brand-dark); }
.cal-ev .t { font-weight: 700; opacity: .85; }
.cal-ev .n { background: rgba(255,255,255,.28); border-radius: 999px; padding: 0 5px;
  font-weight: 700; font-size: 10px; }
.cal-key { display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  vertical-align: -1px; margin-right: 3px; }
.cal-key.group { background: var(--brand); }
.cal-key.invite { background: var(--blue-soft); }
@media (max-width: 760px) {
  .cal-cell { min-height: 64px; }
  .cal-ev { font-size: 10px; }
  .cal-ev .t, .cal-ev .n { display: none; }
}

.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.flag-row td { background: var(--red-soft) !important; }
.over-row td { background: var(--amber-soft) !important; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
code { background: #f0f1f4; padding: 2px 6px; border-radius: 5px; font-size: 12.5px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.kbd-list td code { font-size: 12px; }
details > summary { cursor: pointer; }
details[open] > summary { margin-bottom: 4px; }
.media-line { display: flex; align-items: center; gap: 10px; }

/* ===== Badge print ===== */
.badge-print { width: 340px; border: 2px solid #111; border-radius: 16px;
  padding: 22px; margin: 30px auto; text-align: center; box-shadow: var(--shadow); }
.badge-print .vphoto.lg { margin: 0 auto 10px; }
.badge-print .vname { font-size: 24px; font-weight: 700; }
.badge-print .vco { color: var(--muted); margin-bottom: 10px; }
.badge-print .bnum { font-size: 40px; font-weight: 800; letter-spacing: 2px; }
.badge-print .meta { font-size: 13px; margin-top: 10px; }
@media print { .no-print { display: none !important; } body { background: #fff; } }

/* ===== Kiosk (shared) ===== */
.kiosk { min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 28px;
  background: radial-gradient(1100px 600px at 50% -10%, #2b3552 0%, #11141d 70%); color: #fff; }
.kiosk-card { background: var(--surface); color: var(--text); border-radius: 22px;
  padding: 38px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.kiosk-card h1 { font-size: 28px; margin-bottom: 6px; }
.kiosk-card .sub { color: var(--muted); margin-bottom: 24px; }
.kiosk-logo { font-size: 24px; font-weight: 700; margin-bottom: 24px; text-align: center;
  letter-spacing: -.02em; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-grid a, .type-grid button { display: block; padding: 24px 16px; border: 1.5px solid var(--border);
  border-radius: 14px; text-align: center; font-weight: 600; color: var(--text);
  background: var(--surface); cursor: pointer; font-size: 15px; font-family: inherit; }
.type-grid a:hover, .type-grid button:hover {
  border-color: var(--brand); color: var(--brand); text-decoration: none;
  background: var(--brand-soft); }
.type-grid .ico { font-size: 32px; display: block; margin-bottom: 8px; }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 100; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { display: none; position: fixed; inset: 0; background: rgba(8,10,16,.5);
    z-index: 90; }
  body.nav-open .nav-scrim { display: block; }
  .menu-toggle { display: block; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 11px 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 0; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 20px; }
  .card { padding: 16px; }
  .btn.lg { width: 100%; }
  h1 { font-size: 20px; }
  /* tables collapse to stacked cards */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td {
    display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 10px; padding: 4px 0; }
  table.responsive tr:hover td { background: transparent; }
  table.responsive td { border: none; padding: 7px 14px; display: flex;
    justify-content: space-between; gap: 14px; text-align: right; }
  table.responsive td::before { content: attr(data-label); font-weight: 700;
    color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: .04em;
    text-align: left; align-self: center; }
  table.responsive td[data-label=""]::before { content: ""; }
  .kiosk-card { padding: 26px 20px; }
  .kiosk-card h1 { font-size: 23px; }
  .auth-card { padding: 26px 22px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
}
