/* groupi web UI */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --side: #f9fafb;
  --line: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --soft: #9ca3af;
  --accent: #4b5563;
  --accent-dark: #374151;
  --blue: #3b82f6;
  --orange: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --sel: #eceef1;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- login */
.login { display: flex; align-items: center; justify-content: center; height: 100%; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 28px; width: 320px; display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.login-card input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; }
.error { color: var(--red); min-height: 16px; font-size: 12px; }

/* ---------- top bar */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; gap: 24px; height: 44px; padding: 0 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; min-width: 150px; }
.logo { width: 22px; height: 22px; border-radius: 4px; background: #d1d5db; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--accent-dark); }
.search { flex: 0 1 380px; display: flex; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 0 8px; height: 28px; }
.search input { border: 0; outline: 0; flex: 1; padding: 4px 6px; background: transparent; font-size: 12px; }
.search-icon { color: var(--soft); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 14px; }
.avatar-wrap { position: relative; }
.avatar { width: 26px; height: 26px; border-radius: 50%; border: 0; background: #d1d5db; font-weight: 700; font-size: 10px; }
.menu { position: absolute; right: 0; top: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; min-width: 220px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.menu-head { font-weight: 600; }
.menu-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.menu-item { width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 0; color: var(--red); }

/* ---------- toolbar */
.toolbar { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.toolbar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 8px; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 4px; padding: 5px 12px; font-size: 12px; white-space: nowrap; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sel); }
.btn.small { padding: 3px 9px; font-size: 11px; }
.btn.danger { color: var(--red); }
.btn.active { background: var(--sel); border-color: #d1d5db; }
.link { border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.link:hover { color: var(--text); }

/* ---------- layout */
.layout { flex: 1; display: grid; grid-template-columns: 196px 1fr 240px; min-height: 0; }
.sidebar { background: var(--side); border-right: 1px solid var(--line); padding: 14px 8px; overflow-y: auto; overflow-x: hidden; }
.side-head { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 8px 6px 10px; }
.side-head:not(:first-child) { margin-top: 24px; }
.nav { width: 100%; display: flex; white-space: nowrap; align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 8px; border-radius: 5px; text-align: left; font-size: 12.5px; }
.nav:hover { background: var(--sel); }
.nav.active { background: #e5e7eb; font-weight: 600; }
.ni { width: 16px; color: var(--muted); text-align: center; }
.badge { margin-left: auto; background: #e5e7eb; border-radius: 9px; font-size: 10px; padding: 1px 7px; color: var(--muted); }

.minical { margin: 26px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 8px; }
.mc-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: 8px; white-space: nowrap; }
.mc-head button { border: 0; background: transparent; color: var(--muted); padding: 0 4px; }
.mc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px 0; text-align: center; font-size: 10.5px; }
.mc-dow { color: var(--soft); font-size: 9px; }
.mc-day { border: 0; background: transparent; padding: 3px 0; border-radius: 50%; font-size: 10.5px; }
.mc-day.other { color: #c4c8cf; }
.mc-day.today { background: var(--accent); color: #fff; border-radius: 10px; }
.mc-day.sel { outline: 1px solid var(--accent); border-radius: 10px; }
.mc-day.has::after { content: ""; display: block; width: 3px; height: 3px; border-radius: 50%; background: var(--blue); margin: 1px auto 0; }

.main { overflow-y: auto; padding: 20px 16px 30px; min-width: 0; }
.rightpanel { border-left: 1px solid var(--line); background: var(--bg); padding: 16px 12px; overflow-y: auto; }
.rp-head { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

/* ---------- cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; }
.card-body { padding: 12px; }
.empty { color: var(--soft); padding: 14px 12px; font-size: 12px; }

.page-date { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.page-title { display: flex; align-items: center; justify-content: space-between; }
.page-title h1 { font-size: 20px; margin: 0 0 14px; font-weight: 600; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { border: 0; background: transparent; padding: 0 0 8px; color: var(--muted); font-size: 12px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); font-weight: 600; border-color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 12px; position: relative; cursor: pointer; }
.stat .label { color: var(--muted); font-size: 11px; }
.stat .value { font-size: 22px; font-weight: 600; margin: 14px 0 8px; }
.stat .sub { color: var(--muted); font-size: 10.5px; }
.stat .si { position: absolute; right: 12px; top: 12px; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: 1.27fr 1fr; gap: 12px; align-items: start; }

.ev { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ev:last-child { border-bottom: 0; }
.ev:hover { background: #fafafa; }
.ev-time { width: 38px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.ev-bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--blue); }
.ev-bar.tentative { background: var(--orange); }
.ev-bar.team { background: var(--green); }
.ev-main { flex: 1; min-width: 0; }
.ev-title { font-weight: 600; }
.ev-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.chip { border: 1px solid var(--line); background: #f3f4f6; border-radius: 4px; font-size: 10px; padding: 2px 7px; color: var(--muted); white-space: nowrap; }
.chip.warn { color: #92400e; }

.task { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task input { width: 14px; height: 14px; }
.task .t-main { flex: 1; }
.task .t-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.task.done .t-title { text-decoration: line-through; color: var(--soft); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #c4a484; }

.invite { padding: 12px; }
.invite .when { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.invite .what { font-weight: 600; font-size: 14px; margin: 6px 0; }
.invite .who { color: var(--muted); font-size: 11px; }
.avatars { display: flex; align-items: center; margin: 12px 0; }
.av { width: 22px; height: 22px; border-radius: 50%; background: #dbeafe; border: 2px solid #fff; margin-left: -5px; font-size: 8.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.av:first-child { margin-left: 0; }
.av:nth-child(2) { background: #fde2e2; } .av:nth-child(3) { background: #d1fae5; } .av:nth-child(4) { background: #e0e7ff; }
.avatars .count { color: var(--muted); font-size: 11px; margin-left: 10px; }
.btnrow { display: flex; gap: 6px; flex-wrap: wrap; }

.file { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); }
.file:last-child { border-bottom: 0; }
.fi { width: 26px; height: 26px; border-radius: 4px; background: #f3f4f6; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.file .f-main { flex: 1; min-width: 0; }
.file .f-name { font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .f-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; }

/* right panel */
.ag { display: flex; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ag:last-child { border-bottom: 0; }
.ag-time { width: 34px; color: var(--muted); font-size: 10.5px; }
.ag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); margin-top: 4px; }
.ag-dot.tentative { background: var(--orange); } .ag-dot.team { background: var(--green); }
.ag-title { font-weight: 600; font-size: 11.5px; }
.ag-sub { color: var(--muted); font-size: 10px; margin-top: 3px; }
.quick { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 12px; text-align: left; }
.quick:last-child { border-bottom: 0; }
.quick:hover { background: #fafafa; }
.quick b { display: block; font-size: 11.5px; }
.quick small { color: var(--muted); font-size: 10px; }
.qi { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--muted); background: #f9fafb; }

/* ---------- mail */
.mail { display: grid; grid-template-columns: 170px 320px 1fr; gap: 12px; height: calc(100vh - 140px); }
.mail .card { margin: 0; overflow: hidden; display: flex; flex-direction: column; }
.scroll { overflow-y: auto; flex: 1; }
.mailbox-picker { margin: 8px 12px 4px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-size: 12px; }
.folder { display: flex; width: 100%; border: 0; background: transparent; padding: 8px 12px; text-align: left; }
.folder:hover { background: #fafafa; }
.folder.active { background: var(--sel); font-weight: 600; }
.folder .badge { margin-left: auto; }
.msg { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.msg:hover { background: #fafafa; }
.msg.active { background: var(--sel); }
.msg.unseen .m-subj { font-weight: 700; }
.msg.unseen { box-shadow: inset 3px 0 0 var(--blue); }
.m-top { display: flex; justify-content: space-between; gap: 8px; }
.m-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-date { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.m-subj { color: var(--accent-dark); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.reader { padding: 16px; }
.reader h2 { margin: 0 0 10px; font-size: 16px; }
.reader .meta { color: var(--muted); font-size: 11.5px; line-height: 1.6; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.reader pre { white-space: pre-wrap; word-wrap: break-word; font-family: inherit; font-size: 13px; line-height: 1.5; margin: 0; }
.atts { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- calendar */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-height: 260px; display: flex; flex-direction: column; }
.day.today { border-color: var(--accent); }
.day-head { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.day-head b { color: var(--text); font-size: 15px; }
.day-ev { margin: 6px 6px 0; padding: 6px 7px; border-radius: 4px; background: #eff6ff; border-left: 3px solid var(--blue); cursor: pointer; font-size: 11px; }
.day-ev.tentative { background: #fffbeb; border-color: var(--orange); }
.day-ev.team { background: #ecfdf5; border-color: var(--green); }
.day-ev.invite { background: #f5f3ff; border-color: #8b5cf6; }
.day-ev .t { color: var(--muted); font-size: 10px; }
.day-add { margin: auto 6px 6px; border: 1px dashed var(--line); background: transparent; border-radius: 4px; color: var(--soft); font-size: 11px; padding: 3px; }
.cal-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.cal-nav .range { font-weight: 600; margin-left: 8px; }

/* ---------- tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fafafa; }
.actions { text-align: right; white-space: nowrap; }

/* ---------- modal + forms */
.modal { position: fixed; inset: 0; background: rgba(17, 24, 39, .35); display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; z-index: 50; }
.modal-box { background: var(--panel); border-radius: 8px; width: 520px; max-width: 94vw; max-height: 84vh; overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,.18); }
.modal-box h2 { margin: 0; padding: 14px 16px; font-size: 15px; border-bottom: 1px solid var(--line); }
.form { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.form input, .form textarea, .form select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 12.5px; background: #fff; }
.form textarea { min-height: 160px; resize: vertical; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.form-error { color: var(--red); font-size: 12px; min-height: 14px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--accent-dark); color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 12px; z-index: 60; }
.toast.err { background: var(--red); }

.section-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 8px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 150px 1fr; }
  .rightpanel { display: none; }
  .mail { grid-template-columns: 150px 1fr; }
  .mail .reader-card { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats, .grid2, .week { grid-template-columns: 1fr; }
}

.att-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; }
.att-chip .link { font-size: 12px; }

/* calendars */
.cal-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.cal-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 12px; cursor: pointer; }
.cal-chip input { margin: 0; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.share-rows { display: grid; gap: 6px; }
.share-row { display: grid; grid-template-columns: 110px 1fr 160px 24px; gap: 6px; align-items: center; }

/* storage quota */
.quota { font-size: 12px; color: var(--muted, #6b7280); padding: 10px 12px 4px; }
.quota.warn { color: #b45309; }
.quota-bar { height: 6px; border-radius: 3px; background: rgba(0,0,0,.08); overflow: hidden; margin-bottom: 4px; }
.quota-bar span { display: block; height: 100%; background: #3b82f6; }
.quota.warn .quota-bar span { background: #f59e0b; }

/* out-of-office indicator */
.vacation-on { margin: 10px 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid #f59e0b; background: #fffbeb;
  color: #92400e; font-size: 12px; text-align: left; cursor: pointer; }
label.check { display: flex; align-items: center; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted, #6b7280); }

/* folder management */
.folder { position: relative; }
.folder-edit { margin-left: auto; padding: 0 4px; opacity: 0; color: var(--muted, #6b7280); }
.folder:hover .folder-edit, .folder.active .folder-edit { opacity: 1; }
.folder-new { color: var(--muted, #6b7280); font-size: 12px; }

/* free/busy */
.fb-wrap { display: flex; flex-direction: column; gap: 6px; }
.fb-row { display: grid; grid-template-columns: 170px 1fr; gap: 8px; align-items: center; font-size: 12px; }
.fb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted, #6b7280); }
.fb-bar { position: relative; height: 16px; border-radius: 4px; background: #eef2f7; overflow: hidden; }
.fb-bar.unknown { background: repeating-linear-gradient(45deg, #eef2f7, #eef2f7 4px, #f8fafc 4px, #f8fafc 8px); }
.fb-busy { position: absolute; top: 0; bottom: 0; background: #64748b; }
.fb-busy.tentative { background: repeating-linear-gradient(45deg, #64748b, #64748b 3px, #cbd5e1 3px, #cbd5e1 6px); }
.fb-sel { position: absolute; top: -1px; bottom: -1px; border: 2px solid #2563eb; border-radius: 3px; background: rgba(37, 99, 235, .12); }
.fb-hours { display: flex; justify-content: space-between; color: var(--muted, #6b7280); font-size: 11px; }

/* HTML mail */
.mail-html { width: 100%; height: 62vh; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.view-toggle { align-items: center; }
.view-toggle .btn.active { background: #1f2937; color: #fff; }

/* recipient suggestions */
.suggest { position: relative; }
.suggest input { width: 100%; }
.suggest-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff;
  border: 1px solid #d1d5db; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto; }
.suggest-item { padding: 6px 10px; cursor: pointer; font-size: 13px; display: flex; gap: 6px; align-items: baseline; }
.suggest-item.active, .suggest-item:hover { background: #eff6ff; }
.suggest-item span { color: var(--muted, #6b7280); }
.suggest-kind { margin-left: auto; font-size: 11px; border: 1px solid #d1d5db; border-radius: 6px; padding: 0 5px; }
.m-snip { font-size: 12px; color: var(--muted, #6b7280); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* mail rules */
.rules { display: flex; flex-direction: column; gap: 6px; }
.rule-row { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border: 1px solid #e5e7eb; border-radius: 8px; }
.rule-row.off .rule-name { color: var(--muted, #6b7280); text-decoration: line-through; }
.rule-name { flex: 1; font-weight: 600; }
.rule-lines { display: flex; flex-direction: column; gap: 6px; }
.rule-line { display: flex; gap: 6px; align-items: center; }
.rule-line > * { min-width: 0; }
.rule-line select { flex: 0 1 auto; width: auto; max-width: 42%; }
.rule-line input { flex: 1 1 80px; width: auto; }
.rule-line .btn { flex: 0 0 auto; }
.form > .btn.small { align-self: flex-start; justify-self: start; width: auto; }
.rule-head { display: flex; gap: 6px; align-items: center; font-size: 13px; }

/* reminders */
.reminders { position: fixed; right: 18px; bottom: 18px; z-index: 55; display: flex; flex-direction: column; gap: 8px; width: 320px; max-width: calc(100vw - 36px); }
.reminder { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: 10px 10px 10px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.14); }
.reminder .rm-main { flex: 1; min-width: 0; }
.reminder .rm-title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder .rm-sub { font-size: 12px; color: var(--muted); }
.choice { display: flex; flex-direction: column; gap: 8px; }
.choice .btn { justify-content: flex-start; text-align: left; }

/* address book */
.dir-search { flex: 1; min-width: 0; max-width: 420px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; }
td .badge { margin-left: 8px; }

/* files */
.crumbs { font-size: 13px; margin: -4px 0 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.crumbs .badge { margin-left: 8px; }
.folder-row { cursor: pointer; }
.folder-row:hover { background: #f9fafb; }
.f-actions { display: flex; gap: 4px; }
.f-name .badge { margin-left: 6px; }
.revs { max-height: 50vh; overflow: auto; margin-bottom: 10px; }
.t-note { font-style: italic; }
.links { display: flex; flex-direction: column; gap: 12px; }
.link-row { display: flex; flex-direction: column; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.link-row input { font-family: ui-monospace, monospace; font-size: 12px; }
.link-row.expired input { color: var(--muted); text-decoration: line-through; }

/* settings / administration */
.card.settings { margin-bottom: 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.badge.warn { background: #fef3c7; color: #92400e; }
.warn-text { color: #b45309; }
.pad { padding: 10px 16px; }
code { font-family: ui-monospace, monospace; font-size: 12px; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }
.addr-input { display: flex; align-items: center; gap: 6px; }
.addr-input input { flex: 1; min-width: 0; }
.addr-input span { color: var(--muted); }

/* super admin tool */
.sa { min-height: 100vh; }
.sa .topbar { display: flex; align-items: center; gap: 16px; }
.sa-node { color: var(--muted); font-size: 12px; flex: 1; }
.sa .top-actions { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sa-main { max-width: 1100px; margin: 0 auto; padding: 20px; }
.sa-main .btnrow { margin-bottom: 12px; }

/* setup wizard */
body.setup { background: var(--bg, #f3f4f6); }
.setup-main { max-width: 760px; margin: 32px auto; padding: 0 16px; }
.setup-main > .brand { font-size: 18px; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.setup-card { margin-top: 16px; }
.code-input { font-family: ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.found { display: flex; flex-direction: column; gap: 8px; }
.found-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 170px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.setup-go { margin-top: 16px; justify-content: flex-end; }

/* online meetings */
html:has(body.meet) { background: #111827; overflow: hidden; }
body.meet { background: #111827; color: #f9fafb; height: 100vh; height: 100dvh; overflow: hidden; }
.meet-lobby { display: flex; align-items: center; justify-content: center; height: 100vh; height: 100dvh; overflow-y: auto; }
.meet-lobby-card { background: #fff; color: #111827; border-radius: 10px; padding: 24px; width: 440px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 12px; }
.meet-lobby-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #6b7280; }
.meet-lobby-card input:not([type=checkbox]) { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; }
.meet-lobby-card .check { flex-direction: row; align-items: center; }
.meet-preview { width: 100%; aspect-ratio: 16 / 9; background: #1f2937; border-radius: 8px; object-fit: cover; transform: scaleX(-1); }
.meet-room { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.meet-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #1f2937; }
.meet-top .ev-sub { color: #9ca3af; }
.meet-spacer { flex: 1; }
.meet-body { flex: 1; display: flex; min-height: 0; }
.meet-grid { flex: 1; display: grid; gap: 8px; padding: 8px; grid-template-columns: 1fr; grid-auto-rows: 1fr; min-height: 0; }
.meet-grid.n2 { grid-template-columns: 1fr 1fr; }
.meet-grid.n3, .meet-grid.n4 { grid-template-columns: 1fr 1fr; }
.meet-grid.n5, .meet-grid.n6 { grid-template-columns: repeat(3, 1fr); }
.meet-grid.n7, .meet-grid.n8, .meet-grid.n9 { grid-template-columns: repeat(3, 1fr); }
.meet-tile { position: relative; background: #1f2937; border-radius: 8px; overflow: hidden; min-height: 0; }
.meet-tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.meet-tile.local video { transform: scaleX(-1); }
.meet-tile.local.screen video, .meet-tile.screen video { transform: none; object-fit: contain; }
.meet-tile .meet-avatar { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 48px; font-weight: 600; color: #e5e7eb; background: #374151; }
.meet-tile.nocam .meet-avatar { display: flex; }
.meet-tile.failed { outline: 2px solid #ef4444; }
.meet-name { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.meet-flags { position: absolute; right: 8px; bottom: 8px; font-size: 14px; }
.meet-tile { cursor: pointer; }
/* presentation: one large, the others small in a row below */
.meet-grid.staged { display: flex; flex-direction: column; }
.meet-stage { flex: 1; min-height: 0; display: flex; }
.meet-stage .meet-tile { flex: 1; }
.meet-stage .meet-tile video { position: absolute; inset: 0; object-fit: contain; }
.meet-strip { flex: none; height: 120px; display: flex; gap: 8px; overflow-x: auto; justify-content: safe center; }
.meet-strip .meet-tile { flex: 0 0 180px; height: 100%; }
.meet-strip .meet-avatar { font-size: 28px; }
.meet-strip .meet-name { font-size: 11px; left: 4px; bottom: 4px; padding: 1px 6px; }
.meet-tile.pinned .meet-name::before { content: "\1F4CC  "; }
@media (max-width: 760px) {
  .meet-strip { height: 84px; }
  .meet-strip .meet-tile { flex-basis: 120px; }
}
.meet-side { width: 320px; background: #fff; color: #111827; display: flex; flex-direction: column; }
.meet-side-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; }
.meet-chat, .meet-people { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.meet-msg { background: #f3f4f6; border-radius: 6px; padding: 6px 8px; word-break: break-word; white-space: pre-wrap; }
.meet-msg.mine { background: #e0e7ff; }
.meet-person { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.meet-chat-form { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid #e5e7eb; }
.meet-chat-form input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; }
.meet-bar { display: flex; justify-content: center; gap: 8px; padding: 10px; background: #1f2937; flex-wrap: wrap; }
.meet-bar .btn { background: #374151; color: #f9fafb; border-color: #4b5563; }
.meet-bar .btn.off { background: #7f1d1d; border-color: #991b1b; }
.meet-bar .btn.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.meet-bar .badge { margin-left: 6px; background: #ef4444; color: #fff; }
.meet-bar .btn .ico, #btn-copy .ico { margin-right: 6px; }
.meet-bar .btn.hidden { display: none; }

/* phones (portrait and landscape) */
.meet-grid.pip { position: relative; grid-template-columns: 1fr; }
.meet-grid.pip.m3, .meet-grid.pip.m4, .meet-grid.pip.m5, .meet-grid.pip.m6 { grid-template-columns: 1fr 1fr; }
.meet-grid.pip .meet-tile.local { position: absolute; right: 14px; bottom: 14px; width: 28%; max-width: 130px; aspect-ratio: 3 / 4; z-index: 2;
  box-shadow: 0 2px 10px rgba(0,0,0,.6); border: 2px solid #374151; }
.meet-grid.pip .meet-tile.local .meet-name { font-size: 10px; left: 4px; bottom: 4px; padding: 1px 5px; }
.meet-grid.pip .meet-tile.local .meet-avatar { font-size: 28px; }
@media (max-width: 760px), (max-height: 500px) {
  .meet-top { padding: 6px 10px; gap: 8px; }
  .meet-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .meet-top .ev-sub { white-space: nowrap; }
  #btn-copy .lbl { display: none; }
  #btn-copy .ico { margin: 0; }
  .meet-grid { padding: 6px; gap: 6px; }
  .meet-bar { flex-wrap: nowrap; gap: 10px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .meet-bar .btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; position: relative; flex: none; }
  .meet-bar .btn .lbl { display: none; }
  .meet-bar .btn .ico { margin: 0; }
  .meet-bar .badge { position: absolute; top: -2px; right: -2px; margin: 0; font-size: 10px; }
  /* chat and participants: over the whole screen instead of a side column */
  .meet-side { position: fixed; inset: 0; width: auto; z-index: 20; }
  .meet-strip .meet-tile { flex-basis: 110px; }
  .meet-strip { height: 80px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .meet-room { flex-direction: row; flex-wrap: wrap; }
  .meet-top { width: 100%; padding: 4px 10px; }
  .meet-body { height: calc(100dvh - 40px); }
  .meet-bar { flex-direction: column; justify-content: center; padding: 6px; height: calc(100dvh - 40px); }
  .meet-bar .btn { width: 42px; height: 42px; font-size: 18px; }
  .meet-grid.pip.m2 { grid-template-columns: 1fr 1fr; }
  .meet-grid.pip .meet-tile.local { aspect-ratio: 4 / 3; width: 22%; }
  .meet-grid.staged { flex-direction: row; }
  .meet-strip { flex-direction: column; height: auto; width: 120px; }
  .meet-strip .meet-tile { flex: 0 0 80px; width: 100%; }
}
.meet-join { margin-right: 8px; white-space: nowrap; text-decoration: none; }
.meet-top .btn { background: #374151; color: #f9fafb; border-color: #4b5563; }
.meet-invite { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.meet-invite input { padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; }
.meet-side-sub { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; margin-top: 6px; }
