:root {
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-soft: #e8f0fe;
  --bg: #f6f8fc;
  --panel: #ffffff;
  --border: #e0e3e8;
  --text: #1f1f1f;
  --muted: #444746;
  --success: #0d652d;
  --danger: #c5221f;
  --header-h: 64px;
  --shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

.material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: var(--header-h);
  background: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.app-header .brand {
  margin: 0;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.app-header-spacer {
  flex: 1;
}

.app-header-user {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 500;
  margin-left: 8px;
}

.user-chip {
  font-size: 13px;
  color: var(--muted);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  color: #5f6368;
  letter-spacing: 0;
}

.brand-logo {
  display: block;
  height: 36px;
  width: auto;
}

.brand-logo--login {
  height: 44px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(32, 33, 36, 0.48);
  display: grid;
  place-items: center;
  padding: 24px;
}

.dialog-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px 20px;
  box-shadow: 0 8px 28px rgba(60, 64, 67, 0.28);
}

.dialog-card h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
}

.dialog-desc {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.dialog-field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}

.dialog-field input,
.dialog-field select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.dialog-field input:focus,
.dialog-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.dialog-message {
  min-height: 18px;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.dialog-message.error {
  color: var(--danger);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.header-search {
  flex: 1;
  max-width: 720px;
  height: 48px;
  margin: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 0 20px;
  background: #e9eef6;
  border-radius: 28px;
  border: 1px solid transparent;
}

.header-search .material-symbols-outlined {
  color: #444746;
  font-size: 24px;
}

.header-search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.header-search input::placeholder {
  color: #444746;
}

.header-search:focus-within {
  background: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.app-body {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.app-frame {
  width: 100%;
  min-width: 0;
  height: calc(100vh - var(--header-h));
  border: 0;
  display: block;
  background: var(--bg);
}

html.nav-shell,
html.nav-shell body {
  height: 100%;
  overflow: hidden;
}

html.embed-page .app-header,
html.embed-page .sidebar,
html.embed-page .jarvis-fab,
html.embed-page .jarvis-panel {
  display: none !important;
}

html.embed-page .app,
html.embed-page .app-body {
  display: block;
  min-height: 0;
  grid-template-columns: none;
}

html.embed-page .content {
  padding-top: 8px;
}

.sidebar {
  background: transparent;
  border-right: 0;
  padding: 12px 8px 24px 6px;
}

.compose-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 12px;
  margin: 0 0 12px 4px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #0b57d0;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.compose-btn .material-symbols-outlined {
  font-size: 24px;
  color: #0b57d0;
}

.compose-btn:hover {
  background: #f6f9ff;
  box-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.menu-item {
  color: #1f1f1f;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px 0 16px;
  border-radius: 0 24px 24px 0;
  font-size: 14px;
  font-weight: 500;
}

.menu-item .material-symbols-outlined {
  font-size: 20px;
  color: #444746;
}

.menu-item:hover {
  background: #e8eaed;
}

.menu-item.active {
  background: #d3e3fd;
  color: #041e49;
}

.menu-item.active .material-symbols-outlined {
  color: #041e49;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 8px 24px 32px;
}

.list-page {
  padding-top: 16px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}

.page-title,
.topbar h1 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
}

.page-head .page-title {
  margin: 0;
}

.page-add-btn {
  gap: 4px;
  padding: 0 16px 0 12px;
  flex: 0 0 auto;
}

.page-add-btn .material-symbols-outlined {
  font-size: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.text-btn,
.secondary-btn,
.primary-btn {
  border: 0;
  border-radius: 20px;
  padding: 0 24px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  min-height: 40px;
}

.text-btn {
  color: #0b57d0;
  background: transparent;
  padding: 0 12px;
  min-height: 40px;
}

.text-btn:hover {
  background: #d3e3fd;
}

.secondary-btn {
  color: #0b57d0;
  background: transparent;
  border: 1px solid #747775;
}

.secondary-btn:hover:not(:disabled) {
  background: #f2f2f2;
}

.primary-btn {
  color: #fff;
  background: var(--primary);
  box-shadow: none;
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.secondary-btn:disabled,
.primary-btn:disabled,
.icon-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #444746;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-family: inherit;
}

.icon-btn:hover:not(:disabled) {
  background: #e8eaed;
}

.panel {
  background: var(--panel);
  border: 0;
  border-radius: 16px;
  min-width: 0;
}

.panel-head {
  padding: 16px 20px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.search-bar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  background: #f1f3f4;
}

.search-bar input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.table-shell {
  background: #fff;
  border-radius: 16px;
  min-width: 0;
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.data-table,
table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td,
th,
td {
  padding: 16px 20px;
  border-bottom: 1px solid #e8eaed;
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

.data-table th,
th {
  font-size: 12px;
  font-weight: 500;
  color: #444746;
  background: #fff;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.face-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.face-tag--yes {
  background: #e6f4ea;
  color: #137333;
}

.face-tag--no {
  background: #f1f3f4;
  color: #5f6368;
}

.loc-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loc-cell .loc-flag {
  width: 20px;
  height: 14px;
  flex: 0 0 auto;
  display: block;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(60, 64, 67, 0.18);
}

.col-actions {
  width: 88px;
  white-space: nowrap;
  text-align: right;
}

.row-delete-btn {
  border: 0;
  background: transparent;
  color: #c5221f;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 16px;
}

.row-delete-btn:hover {
  background: #fce8e6;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

td.wrap-cell,
th.wrap-cell {
  white-space: normal;
  word-break: break-word;
}

.muted-cell {
  color: #444746;
}

tbody tr:hover,
.data-table tbody tr:hover {
  background: #f8fafd;
}

.site-link {
  color: #0b57d0;
  text-decoration: none;
  font-weight: 500;
}

.site-link:hover {
  text-decoration: underline;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 8px 12px 12px;
  color: #444746;
  font-size: 13px;
}

.empty-hint {
  padding: 72px 16px;
  text-align: center;
  color: #444746;
}

.empty-hint .material-symbols-outlined {
  font-size: 48px;
  color: #9aa0a6;
  margin-bottom: 8px;
}

.empty-hint p {
  margin: 0;
  font-size: 16px;
}

.status-bar {
  margin-bottom: 16px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--primary-soft);
  font-size: 13px;
  color: #0842a0;
}

.status-bar.success {
  background: #e6f4ea;
  color: var(--success);
}

.status-bar.error {
  background: #fce8e6;
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.login-body {
  background: #fff;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: 100%;
  max-width: 450px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 48px 40px 36px;
}

.login-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-title {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  text-align: center;
}

.login-desc {
  margin: 8px 0 32px;
  color: var(--text);
  font-size: 16px;
  text-align: center;
  font-weight: 400;
}

.login-2fa-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.settings-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  width: min(720px, 100%);
  max-width: 720px;
}

.password-hints {
  margin: 4px 0 16px;
}

.password-hints-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.password-hints ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.password-hints li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.hint-mark {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 2px solid #202124;
  border-radius: 50%;
  box-sizing: border-box;
  position: relative;
  background: transparent;
}

.password-hints li.ok .hint-mark {
  border: 0;
  background: #1e8e3e;
}

.password-hints li.ok .hint-mark::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.settings-table {
  margin-top: 16px;
}

.settings-table tbody tr,
.settings-table tbody tr:hover {
  cursor: default;
}

.ip-blocked-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fce8e6;
  color: var(--danger);
  font-size: 12px;
}

.settings-card h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.settings-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-form {
  margin-top: 20px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.settings-status.on {
  color: var(--success);
}

.switch {
  position: relative;
  width: 40px;
  height: 24px;
  flex: 0 0 auto;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-ui {
  position: absolute;
  inset: 0;
  background: #dadce0;
  border-radius: 12px;
  transition: background 0.15s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-ui {
  background: #1a73e8;
}

.switch input:checked + .switch-ui::after {
  transform: translateX(16px);
}

.totp-setup {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.totp-qr {
  width: 248px;
  height: 248px;
  margin: 16px 0;
  padding: 0;
  border: 0;
  background: #fff;
}

.totp-qr img,
.totp-qr svg {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.totp-secret {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.totp-secret code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form .text-btn {
  width: 100%;
}

.field {
  display: grid;
  gap: 0;
  font-size: 12px;
  color: var(--muted);
}

.field input {
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 13px 15px;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.login-form .primary-btn {
  margin-top: 10px;
  width: 100%;
  height: 40px;
  border-radius: 4px;
}

.login-hint {
  margin: 24px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.login-message {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.login-message.error {
  color: var(--danger);
}

.site-footer {
  margin-top: 24px;
  padding: 12px 0 4px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.content .site-footer {
  margin-top: auto;
}

@media (max-width: 900px) {
  .app-header {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px 12px;
  }

  .header-search {
    order: 3;
    flex: 1 1 100%;
    margin: 4px 0 0;
    max-width: none;
  }

  .app-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 8px 12px 0;
  }

  .compose-btn {
    margin: 8px 0;
  }

  .menu-item {
    border-radius: 24px;
  }

  .content {
    padding: 8px 12px 24px;
  }

  .login-panel {
    border: 0;
    padding: 32px 16px;
  }
}
