:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7f5;
  color: #171717;
  font-synthesis: none;
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f7f7f5; color: #171717; }
a { color: inherit; }
button, input, select { font: inherit; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 62px;
  background: rgba(247,247,245,.96);
  border-bottom: 1px solid #e5e5e1;
  backdrop-filter: blur(16px);
}
.top-inner {
  width: min(1120px, 100%);
  min-height: 62px;
  margin: 0 auto;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-left { min-width: 0; display: flex; align-items: center; gap: 12px; }
.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #171717;
  text-decoration: none;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.012em;
}
.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #fff;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
}
.app-name { white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-action-form { display: inline-flex; margin: 0; }
.header-icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #555;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
}
.header-icon-button:hover, .header-overflow[open] > summary { background: #ecece8; color: #171717; }
.header-icon-button:focus-visible { outline: 2px solid #171717; outline-offset: 2px; }
.header-icon { width: 27px; height: 27px; display: block; }
.header-overflow { display: none; position: relative; }
.header-overflow summary { list-style: none; }
.header-overflow summary::-webkit-details-marker { display: none; }
.header-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  display: flex;
  gap: 3px;
  padding: 6px;
  background: #fff;
  border: 1px solid #dfdfda;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(17,17,17,.12);
}

.card {
  width: min(560px, calc(100% - 32px));
  margin: 10vh auto;
  padding: 32px;
  background: #fff;
  border: 1px solid #e5e5e1;
  border-radius: 18px;
}
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.public-install { padding-top: 10px; }

.button, button:not(.header-icon-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #d9d9d4;
  border-radius: 9px;
  padding: .46rem .72rem;
  background: #fff;
  color: #171717;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover, button:not(.header-icon-button):hover { background: #f1f1ed; }
.button.primary { background: #171717; color: #fff; border-color: #171717; }
.button.primary:hover { background: #2c2c2c; }
.quiet-button { color: #6b6f78; }

.manage { width: min(1120px, calc(100% - 36px)); margin: 0 auto 72px; }
.section-nav {
  display: flex;
  gap: 6px;
  padding: 18px 0 8px;
  overflow-x: auto;
}
.section-nav a {
  padding: .48rem .72rem;
  border-radius: 9px;
  color: #6b6f78;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 650;
}
.section-nav a:hover { background: #ecece8; color: #171717; }
.section-nav a.active { background: #171717; color: #fff; }

.hero { margin: 24px 0 20px; }
.hero.compact { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.hero h1 { margin: 0 0 .18rem; font-size: 1.72rem; letter-spacing: -.025em; }
.hero p { margin: 0; color: #71757f; }
.count-pill, .version-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ecece8;
  color: #555a63;
  font-size: .78rem;
  font-weight: 750;
  padding: .3rem .58rem;
  white-space: nowrap;
}
.eyebrow { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #777b84; }
.muted { color: #777b84; }
.small { font-size: .84rem; }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  margin: 0 0 14px;
}
.filters input, .filters select {
  min-height: 40px;
  border: 1px solid #d9d9d4;
  border-radius: 10px;
  padding: .52rem .68rem;
  background: #fff;
  color: #171717;
}

.publication-list {
  overflow: visible;
  background: #fff;
  border: 1px solid #e5e5e1;
  border-radius: 14px;
}
.publication-row {
  min-height: 82px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #ecece8;
}
.publication-row:last-child { border-bottom: 0; }
.publication-info { min-width: 0; }
.publication-info h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.publication-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: #777b84; font-size: .8rem; }
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .18rem .48rem;
  font-size: .72rem;
  font-weight: 720;
}
.status-badge.is-published { background: #eef5ef; color: #43614a; }
.status-badge.is-unpublished { background: #f0f0ed; color: #666a72; }
.publication-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.publication-actions form { margin: 0; display: inline-flex; }
.more-menu { position: relative; }
.more-menu > summary {
  width: 40px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9d9d4;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  list-style: none;
  letter-spacing: .08em;
}
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu[open] > summary { background: #f1f1ed; }
.more-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 15;
  width: 190px;
  padding: 7px;
  background: #fff;
  border: 1px solid #dfdfda;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17,17,17,.12);
}
.more-popover form { display: block; width: 100%; }
.more-popover button { width: 100%; justify-content: flex-start; border: 0; background: transparent; }

.empty-state { padding: 34px 18px; text-align: center; color: #777b84; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }
.pagination a { text-decoration: none; padding: .4rem .56rem; border-radius: 8px; }
.pagination a:hover { background: #ecece8; }
.pagination .page-current { min-width: 2rem; text-align: center; padding: .4rem .56rem; border-radius: 8px; font-weight: 700; background: #171717; color: #fff; }
.pagination .page-summary { color: #777b84; margin-left: .2rem; font-size: .84rem; }

.panel {
  margin-top: 16px;
  padding: 20px;
  background: #fff;
  border: 1px solid #e5e5e1;
  border-radius: 14px;
}
.panel h2 { margin: 0 0 5px; font-size: 1.05rem; }
.panel p { margin: 0; color: #71757f; }
.slim-panel { padding-block: 17px; }
.panel-heading { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: #efefeb; flex: 0 0 auto; }
.segmented form { margin: 0; }
.segmented button { min-height: 34px; border: 0; background: transparent; color: #666a72; }
.segmented button.selected { background: #fff; color: #171717; box-shadow: 0 1px 3px rgba(17,17,17,.1); }

.device-list { border-top: 1px solid #ecece8; }
.device-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, auto) minmax(130px, auto) auto;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid #ecece8;
}
.device-row:last-child { border-bottom: 0; }
.device-time { display: flex; flex-direction: column; gap: 2px; color: #4f535b; font-size: .84rem; }
.device-time > span { color: #8a8e96; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }

.plugin-summary { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.plugin-summary h2 { margin-top: 4px; font-size: 1.25rem; }
.plugin-summary p { max-width: 650px; }
.plugin-download { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.install-steps { margin: 22px 0 10px; padding-left: 1.35rem; }
.install-steps li { margin: .55rem 0; padding-left: .18rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

@media (max-width: 760px) {
  .manage { width: min(100% - 24px, 1120px); }
  .filters { grid-template-columns: 1fr auto; }
  .filters input { grid-column: 1 / -1; }
  .publication-row { align-items: flex-start; flex-direction: column; gap: 12px; }
  .publication-actions { width: 100%; flex-wrap: wrap; }
  .publication-actions .more-menu { margin-left: auto; }
  .device-row { grid-template-columns: 1fr auto; gap: 12px; }
  .device-time { display: none; }
  .setting-row, .plugin-summary { align-items: flex-start; flex-direction: column; }
  .plugin-download { width: 100%; justify-content: space-between; }
}

@media (max-width: 560px) {
  .header-actions { display: none; }
  .header-overflow { display: block; }
  .top-inner { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); gap: 8px; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .app-name { font-size: 15px; }
  .card { margin-top: 7vh; padding: 24px; }
  .section-nav { padding-top: 12px; }
  .hero.compact { align-items: flex-start; }
  .count-pill { margin-top: 2px; }
  .publication-actions .button, .publication-actions button { min-height: 36px; }
}

/* Publications table UI */
.table-filters {
  grid-template-columns: minmax(260px, 1fr) 150px auto;
  margin-bottom: 12px;
}
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}
.data-table th,
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #ecece8;
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  color: #737780;
  background: #fafaf8;
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .015em;
}
.data-table thead th:first-child { border-top-left-radius: 14px; }
.data-table thead th:last-child { border-top-right-radius: 14px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fcfcfa; }
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 48%; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 16%; }
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 27%; }
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 9%; }
.title-cell { min-width: 0; }
.publication-title-text { display: block; color: #191919; font-weight: 690; }
.publication-title-link {
  display: block;
  overflow: hidden;
  color: #191919;
  font-weight: 690;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.publication-title-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.data-table .publication-path-row td {
  width: auto !important;
  padding-top: 11px;
  padding-bottom: 2px;
  border-bottom: 0;
}
.data-table .publication-main-row td {
  padding-top: 4px;
}
.data-table .publication-path-row:hover td,
.data-table .publication-path-row:hover + .publication-main-row td,
.data-table .publication-path-row:has(+ .publication-main-row:hover) td {
  background: #fcfcfa;
}
.publication-path {
  display: block;
  width: 100%;
  overflow: hidden;
  color: #8a8e96;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.updated-cell { color: #72767e; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions-heading, .actions-cell { text-align: right !important; }
.actions-cell { position: relative; overflow: visible; }
.row-menu { position: relative; display: inline-block; }
.row-menu > summary {
  width: 36px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #62666d;
  cursor: pointer;
  list-style: none;
  font-weight: 750;
  letter-spacing: .09em;
  user-select: none;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary:hover,
.row-menu[open] > summary { background: #eeeeea; color: #171717; }
.row-menu-popover {
  position: fixed;
  right: auto;
  top: auto;
  left: 0;
  z-index: 100;
  width: 210px;
  padding: 6px;
  background: #fff;
  border: 1px solid #deded9;
  border-radius: 11px;
  box-shadow: 0 12px 34px rgba(20,20,20,.15);
  text-align: left;
}
.row-menu-popover form { display: block; width: 100%; margin: 0; }
.row-menu-popover .button,
.row-menu-popover button:not(.header-icon-button) {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: .44rem .6rem;
  font-size: .9rem;
}
.row-menu-popover .button:hover,
.row-menu-popover button:not(.header-icon-button):hover { background: #f1f1ed; }
.plugin-settings .plugin-help { margin-top: 14px; }

@media (max-width: 640px) {
  .manage { width: calc(100% - 24px); }
  .table-hero { margin-top: 24px; }
  .table-filters { grid-template-columns: 1fr 118px; }
  .table-filters input { grid-column: 1 / -1; }
  .data-table th, .data-table td { padding: 11px 10px; }
  .data-table th:nth-child(1), .data-table td:nth-child(1) { width: 49%; }
  .data-table th:nth-child(2), .data-table td:nth-child(2) { width: 21%; }
  .data-table th:nth-child(3), .data-table td:nth-child(3) { width: 21%; }
  .data-table th:nth-child(4), .data-table td:nth-child(4) { width: 9%; }
  .data-table th { font-size: .68rem; }
  .updated-cell { font-size: .74rem; white-space: normal; line-height: 1.25; }
  .status-badge { font-size: .66rem; padding: .14rem .36rem; }
  .row-menu-popover { width: 200px; }
}

.auth-table-page { width: min(1000px, calc(100% - 36px)); padding-top: 28px; }
.admin-card {
  background: #fff;
  border: 1px solid #e5e5e1;
  border-radius: 18px;
  padding: 22px;
}
.admin-card h1 { margin: 0 0 5px; font-size: 30px; letter-spacing: -.035em; line-height: 1.12; }
.publication-count { margin: 0; font-size: 13px; }
.admin-card .table-filters { margin-top: 18px; }
.admin-card .table-scroll { margin-top: 0; border: 1px solid #e5e5e1; border-radius: 16px; background: #fff; }
.admin-card .pagination { margin-bottom: 0; }

@media (max-width: 650px) {
  .auth-table-page { width: calc(100% - 28px); padding-top: 22px; }
  .admin-card { padding: 20px; }
  .admin-card h1 { font-size: 27px; }
}
