:root {
  --ink: #202124;
  --muted: #5f6368;
  --line: #e6e8eb;
  --bg: #f6f7f8;
  --card: #fff;
  --accent: #f15c2e;
  --accent-ink: #fff;
  --danger: #c5221f;
  --ok: #137333;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); }
h1, h2, p { margin-top: 0; }
.brand { display: inline-flex; text-decoration: none; }
.brand-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
.brand-logo-lg {
  height: 40px;
  max-width: 220px;
  margin: 0 auto 0.75rem;
}
.login-card .brand-logo-lg,
.form-card .brand-logo-lg { margin-left: auto; margin-right: auto; }
.tagline { margin: 0; color: var(--muted); }
.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.hint, .muted { color: var(--muted); font-size: 0.92rem; }
.error, .flash {
  margin: 1rem 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fce8e6;
  color: var(--danger);
}
.flash { background: #e6f4ea; color: var(--ok); }

.login-wrap, .form-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.login-card, .form-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 36px;
}
.form-card { max-width: 560px; }
.login-card .btn, .form-card .btn { width: 100%; margin-top: 8px; }
.login-card .hint { margin-top: 12px; }

form label { display: block; margin: 14px 0; font-weight: 600; font-size: 0.92rem; }
input, textarea, select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-user { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.inbox, .detail { padding: 24px; max-width: 1100px; margin: 0 auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filters a {
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.filters a.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filters .spacer { flex: 1; min-width: 8px; }
.filter-select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.filter-select {
  width: auto;
  min-width: 160px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
}
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: visible; }
table thead th:first-child { border-top-left-radius: 12px; }
table thead th:last-child { border-top-right-radius: 12px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.empty { color: var(--muted); }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill-open { background: #fef7e0; color: #b06000; }
.pill-completed { background: #e6f4ea; color: var(--ok); }
.detail { display: grid; gap: 16px; }
.panel { background: #fff; border-radius: 12px; padding: 24px; }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.detail-head-actions { display: flex; align-items: center; gap: 10px; }
dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 18px; }
dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; }
dd { margin: 4px 0 0; }
.message { white-space: pre-wrap; }
.notes { list-style: none; padding: 0; }
.notes li { border-top: 1px solid var(--line); padding: 12px 0; }
.notes p { white-space: pre-wrap; }
.col-actions { width: 44px; text-align: right; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: #c9cdd2; }
.icon-btn-danger:hover { color: var(--danger); border-color: #f5c2c0; background: #fce8e6; }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.delete-modal {
  border: 0;
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.delete-modal::backdrop { background: rgba(32, 33, 36, 0.45); }
.delete-modal form { margin: 0; padding: 24px; }
.delete-modal h2 { margin: 0 0 8px; font-size: 1.15rem; }
.delete-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.inbox .flash { margin-bottom: 16px; }
.status-actor { margin-top: 4px; font-size: 0.8rem; word-break: break-all; }
.topnav { display: flex; gap: 12px; margin-top: 6px; }
.topnav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.topnav a.is-active { color: var(--accent); }
.forms-layout { display: grid; gap: 16px; }
.forms-layout h1, .forms-layout h2, .forms-layout h3 { margin-bottom: 0.5rem; }
.snippet {
  background: #1e1f22;
  color: #e8eaed;
  padding: 16px;
  border-radius: 8px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.inline-form { display: inline; }
.field-add-form, .inline-source-form { max-width: 640px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.checkbox-label input { width: auto; margin: 0; }
.fields-table code { font-size: 0.85rem; }
.menu { position: relative; display: inline-flex; z-index: 1; }
.menu.is-open { z-index: 40; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px;
  z-index: 50;
}
.menu-panel.is-up {
  top: auto;
  bottom: calc(100% + 4px);
}
.panel { overflow: visible; }
.forms-table td.col-actions { overflow: visible; }
.menu-panel button,
.menu-panel form button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.menu-panel button:hover,
.menu-panel form button:hover { background: var(--bg); }
.menu-panel .menu-danger { color: var(--danger); }
.menu-panel form { margin: 0; }
.archived-block { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; }
.archived-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.archived-chevron { display: inline-block; transition: transform 0.15s ease; }
.archived-toggle.is-open .archived-chevron { transform: rotate(90deg); }
.archived-panel { margin-top: 12px; }
@media (min-width: 960px) {
  .forms-layout { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .detail .panel:first-child { grid-column: 1 / -1; }
}
