/* The look of Chat Relay's phone app (its Teams-like palette, font stack and ⋮ menu), sized for touch. */
:root {
  --text: #242424;
  --text-2: #616161;
  --text-3: #757575;
  --page: #f1f3f6;
  --surface: #fff;
  --border: #e0e0e0;
  --hover: #f5f5f5;
  --accent: #5b5fc7;
  --accent-hover: #4f52b2;
  --accent-off: #c7c8e8;
  --error: #a4262c;
  --error-bg: #fde7e9;
  --ok: #107c10;
  --ok-bg: #dff6dd;
  --theme: #1c244b;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  font-size: 15px;
  line-height: 21px;
  color: var(--text);
  background: var(--page);
  -webkit-tap-highlight-color: transparent;
}
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 13px; }

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 62rem;
  margin: 0 auto;
  background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
}

/* header: like Chat Relay's .guest-head */
.head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px 16px;
  /* The one head style of the secforge phone apps (dark red, white text, white app icon), as in the approvals app. */
  background: #7a1c24;
  color: #fff;
}
.head-icon { width: 28px; height: 28px; flex: none; }
.head h1 { flex: 1; min-width: 0; margin: 0; font-size: 1.15rem; line-height: 1.4; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-warn { padding: 8px 16px; background: #fdecea; color: var(--error); font-size: 14px; }
.head .icon-btn {
  width: 36px; height: 36px; padding: 0; border: none; border-radius: 4px;
  background: none; color: var(--text-2); font-size: 22px; line-height: 36px; cursor: pointer;
}
.icon-btn:active { background: var(--hover); }

/* The one ⋮ menu of every secforge app: the look of chat-relay's AppMenu. */
.menu-wrap { position: relative; }
.menu-toggle {
  display: flex; align-items: center; padding: 4px 12px; border: none; background: none;
  color: inherit; font-size: 28px; font-weight: 900; line-height: 1; cursor: pointer;
}
.menu {
  position: absolute; top: 100%; right: 0; z-index: 200; min-width: 200px; max-width: calc(100vw - 32px);
  margin-top: 8px; padding: 8px 0; border: 1px solid #e0e0e0; border-radius: 12px;
  background: #fff; color: #1a1a1a; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}
.menu-item {
  display: block; width: 100%; padding: 8px 14px; border: none; background: none; color: inherit;
  font: inherit; font-size: 14px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.menu-item:hover, .menu-item:active { background: #f2f2f2; }
.menu-tick { width: 16px; height: 16px; margin-right: 8px; vertical-align: middle; opacity: 0.7; }
.menu-divider { height: 1px; margin: 6px 0; background: #e0e0e0; }
.menu-note { padding: 4px 14px 4px 38px; font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-version { padding: 4px 14px 2px 38px; font-size: 12px; color: #888; white-space: nowrap; }
.menu-version.mismatch { color: #b3261e; }

main { flex: 1; }
.pad { padding: 16px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; margin-top: 6px; min-height: 18px; }
.error { color: var(--error); }

/* job list: rows like Chat Relay's lists */
.jobs { list-style: none; margin: 0; padding: 0; }
.job {
  position: relative; display: block; width: 100%; padding: 14px 40px 14px 16px;
  border: none; border-bottom: 1px solid var(--border); background: var(--surface);
  text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.job:active { background: var(--hover); }
.job-title { display: block; font-weight: 600; }
.job-meta { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; }
.job-error { display: block; font-size: 13px; color: var(--error); margin-top: 4px; }
.chev { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--text-3); }

.section-head {
  margin: 0; padding: 18px 16px 6px; font-size: 13px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border);
}

.empty { text-align: center; padding: 56px 16px 24px; color: var(--text-2); }
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: var(--page);
  color: var(--text-3); font-size: 28px; line-height: 56px;
}
.empty-icon.ok { background: var(--ok-bg); color: var(--ok); }

/* job detail */
.bar { padding: 8px 8px 0; }
.block { padding: 12px 16px; }
.block h2 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 16px; color: var(--text-2); font-size: 13px; }
.page-img {
  display: block; width: calc(100% - 32px); margin: 4px 16px 8px; background: #fff;
  border: 1px solid var(--border); border-radius: 6px;
}
.sign-box { border-top: 1px solid var(--border); margin-top: 8px; }
label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input[type=password] {
  width: 100%; min-height: 48px; padding: 8px 12px; font-size: 24px; letter-spacing: 6px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
input[type=password]:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }

.notice { margin: 10px 0 0; padding: 10px 12px; border-radius: 4px; background: var(--page); color: var(--text); font-size: 14px; }
.notice.error { margin: 16px; background: var(--error-bg); color: var(--error); }

/* buttons: Chat Relay's accent buttons, touch height */
button { font: inherit; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions.center { justify-content: center; }
.actions button, #again {
  min-height: 40px; padding: 0 20px; border-radius: 4px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.actions button:active { background: var(--accent-hover); }
.actions button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 400; }
.actions button:disabled { background: var(--accent-off); border-color: var(--accent-off); color: #fff; }
.ghost {
  width: 40px; height: 36px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface);
  color: var(--text); font-size: 20px; cursor: pointer;
}
.link { border: none; background: none; color: var(--accent); padding: 8px; font-weight: 600; cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(28rem, calc(100vw - 32px)); padding: 10px 16px; border-radius: 8px; z-index: 20;
  background: rgb(36 36 36 / 90%); color: #fff; font-size: 14px; box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
}
.toast.error { background: var(--error); }
.toast.ok { background: var(--ok); }
label.check { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 14px; color: var(--text); }
label.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
#pin-cached { margin: 0; }
#pin-cached .link { padding: 0 0 0 6px; }
[hidden] { display: none !important; }
