:root {
  --navy: #123a5a;
  --navy-2: #0b2b45;
  --blue: #1a73e8;
  --green: #16825d;
  --paper: #ffffff;
  --bg: #f3f6f9;
  --ink: #16202a;
  --muted: #667585;
  --line: #dce4eb;
  --danger: #b3261e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); min-height: 100vh; }
button, input, select { font: inherit; }
button, .button { cursor: pointer; }
.hidden { display: none !important; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right, #dbeaf5, transparent 42%), var(--bg); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(15, 45, 70, .06); }
.login-card { width: min(420px, 100%); padding: 36px; }
.login-card h1 { margin: 16px 0 6px; }
.brand-mark { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, var(--navy), #277cac); font-weight: 800; letter-spacing: -.04em; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 9px; }
label { display: grid; gap: 7px; color: #40505e; font-weight: 600; font-size: 14px; margin-top: 18px; }
input, select { min-height: 42px; border: 1px solid #c7d2dc; border-radius: 9px; padding: 9px 11px; color: var(--ink); background: white; }
input:focus, select:focus { outline: 3px solid rgba(26, 115, 232, .15); border-color: var(--blue); }
button, .button { border: 0; border-radius: 9px; padding: 10px 15px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.primary { background: var(--navy); color: white; }
.primary:hover { background: var(--navy-2); }
.secondary { background: #e8f1f8; color: var(--navy); }
.ghost { background: transparent; color: var(--navy); }
.login-card .primary { width: 100%; margin-top: 24px; }
.muted { color: var(--muted); margin: 4px 0; }
.error { color: var(--danger); min-height: 20px; }
header { height: 64px; padding: 0 max(24px, calc((100% - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand, .header-actions { display: flex; align-items: center; gap: 12px; }
main { max-width: 1180px; margin: 0 auto; padding: 42px 24px 80px; }
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 30px; }
.hero h1, .section-title h2 { margin: 2px 0 6px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .13em; color: var(--green); margin: 0; }
.google-box { min-width: 330px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #e9f5ef; border: 1px solid #c9e6d8; border-radius: 12px; padding: 14px 16px; }
.google-box p { margin: 4px 0 0; font-size: 13px; color: #3e6657; }
.toolbar { padding: 12px; display: flex; justify-content: space-between; gap: 16px; margin: 30px 0 18px; }
.toolbar input { width: min(360px, 100%); }
.query-label { display: flex; align-items: center; gap: 9px; margin: 0; white-space: nowrap; }
.query-label select { min-width: 280px; max-width: 420px; }
.inline-label { display: flex; align-items: center; gap: 9px; margin: 0; white-space: nowrap; }
.inline-label select { min-width: 140px; }
.view-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.view-card { padding: 18px; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 14px; }
.view-icon { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; background: #e8f1f8; color: var(--navy); font-size: 23px; }
.view-card h3 { margin: 2px 0; font-size: 16px; overflow-wrap: anywhere; }
.schema { color: var(--muted); font-size: 12px; }
.open-sheet { white-space: nowrap; }
.open-sheet[disabled] { opacity: .65; cursor: wait; }
.notice { padding: 13px 16px; border-radius: 10px; margin-bottom: 16px; background: #e9f5ef; border: 1px solid #c9e6d8; color: #285845; }
.notice.error-notice { background: #fdecea; border-color: #f4c7c3; color: var(--danger); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.admin-section { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--line); }
.section-title { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.admin-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; }
.user-list, .permission-panel { padding: 12px; min-height: 250px; }
.user-row { width: 100%; background: transparent; text-align: left; display: block; padding: 12px; border-bottom: 1px solid var(--line); border-radius: 7px; color: var(--ink); }
.user-row:hover, .user-row.active { background: #e8f1f8; }
.user-row span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.permission-panel h3 { margin: 4px 4px 14px; }
.permission-list { display: grid; gap: 2px; max-height: 380px; overflow: auto; }
.permission-list label { display: flex; align-items: center; gap: 9px; margin: 0; padding: 8px; font-weight: 500; }
.permission-list input, .check input { min-height: auto; }
.save-permissions { margin: 16px 4px 4px; }
dialog { width: min(480px, calc(100% - 32px)); border: 0; border-radius: 14px; padding: 0; box-shadow: 0 24px 70px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(7, 25, 39, .52); }
dialog form { padding: 24px; }
.dialog-title, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-title h2 { margin: 0; }
.dialog-actions { justify-content: flex-end; margin-top: 24px; }
.icon-button { background: transparent; font-size: 26px; color: var(--muted); padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; }
@media (max-width: 850px) {
  .hero, .view-grid, .admin-grid { grid-template-columns: 1fr; }
  .google-box { min-width: 0; }
  .view-card { grid-template-columns: 46px 1fr; }
  .open-sheet { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  main { padding: 28px 14px 60px; }
  .toolbar, .hero { display: grid; }
  .inline-label, .query-label { justify-content: space-between; }
  .query-label select { min-width: 0; width: min(420px, 100%); }
  #user-name { display: none; }
}
