:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d9dee7;
  --panel: #ffffff;
  --accent: #166534;
  --accent-text: #ffffff;
  --warn: #b45309;
  --danger: #b91c1c;
  --soft: #eef2f7;
}

* {
  box-sizing: border-box;
}

body {
  max-width: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.topbar {
  height: 56px;
  max-width: 100vw;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
}

.topbar-spacer {
  flex: 1;
}

.portal-body {
  background: #f5f6f7;
  color: #182230;
}

.portal-body .topbar {
  height: 58px;
  padding: 0 28px;
  border-bottom-color: #d7dde5;
  background: #ffffff;
  box-shadow: none;
}

.portal-body .brand {
  color: #172033;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.portal-nav {
  display: flex;
  flex: 0 1 auto;
  gap: 6px;
}

.portal-nav a {
  padding: 7px 9px;
  border-radius: 5px;
  color: #334155;
  font-weight: 700;
  text-decoration: none;
}

.portal-nav a:hover {
  background: #eef2f7;
}

.portal-body main {
  width: min(980px, calc(100vw - 56px));
  margin-top: 28px;
}

.portal-body h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
}

.portal-body main > h1 {
  margin-bottom: 22px;
}

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

.portal-body .panel {
  padding: 22px;
  border-color: #d7dde5;
  border-radius: 6px;
  box-shadow: none;
}

.portal-body .panel-title {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e9ef;
  color: #182230;
  font-size: 16px;
  font-weight: 800;
}

.portal-body .form-grid {
  gap: 14px;
}

.portal-body .settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.portal-body .span-2 {
  grid-column: span 2;
}

.portal-body .repeat-field {
  grid-column: span 2;
  max-width: 460px;
}

.portal-body label {
  color: #5d6b7c;
  font-size: 12px;
  letter-spacing: 0;
}

.portal-body input,
.portal-body select,
.portal-body textarea {
  min-height: 40px;
  border-color: #c8d1dc;
  border-radius: 5px;
  background: #ffffff;
}

.portal-body input:focus,
.portal-body select:focus,
.portal-body textarea:focus {
  border-color: #166534;
  outline: 3px solid rgba(22, 101, 52, 0.12);
}

.portal-body button {
  min-height: 40px;
  border-radius: 5px;
  background: #146c43;
}

.portal-body button:hover {
  filter: none;
  background: #0f5b37;
}

.portal-body .stack-form > button {
  justify-self: end;
  min-width: 220px;
}

.portal-body .button-row {
  justify-content: flex-end;
}

.portal-body .inline-form button,
.portal-body .name-edit-form button {
  min-height: 36px;
  padding: 8px 12px;
}

.portal-body .hint {
  margin: 10px 0 0;
}

.portal-body .destination-only-form {
  grid-template-columns: minmax(180px, 0.75fr) minmax(280px, 1fr) 260px;
}

.portal-body .setting-row {
  margin-top: 12px;
  padding: 13px 14px;
  border-color: #d7dde5;
  border-radius: 5px;
  background: #f8fafb;
}

.portal-body .setting-row strong {
  color: #172033;
}

.name-edit-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.watcher-title-cell {
  display: grid;
  min-width: 240px;
  gap: 8px;
}

.watcher-title-cell strong {
  color: #172033;
}

.joined-input,
.range-inputs {
  display: grid;
  gap: 8px;
}

.joined-input {
  grid-template-columns: minmax(120px, 1fr) 112px;
}

.range-inputs {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.compact-range {
  min-width: 230px;
}

.range-separator {
  color: #64748b;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.notification-list {
  display: grid;
  gap: 10px;
}

.portal-destination-list {
  display: grid;
  gap: 10px;
}

.portal-destination-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(320px, auto);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid #d7dde5;
  border-radius: 5px;
  background: #fff;
}

.portal-destination-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.portal-destination-main span {
  color: #64748b;
  font-size: 12px;
}

.portal-destination-status {
  padding-top: 2px;
}

.portal-destination-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.portal-watcher-list {
  display: grid;
  gap: 10px;
}

.portal-watcher-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d7dde5;
  border-radius: 5px;
  background: #fff;
}

.portal-watcher-card-header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.portal-watcher-badges,
.portal-watcher-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.portal-watcher-card-body {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.1fr) minmax(130px, 0.6fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e9ef;
}

.portal-watcher-card-body section {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.portal-watcher-card .inline-form {
  flex-wrap: wrap;
}

.notification-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d7dde5;
  border-radius: 5px;
  background: #ffffff;
}

.notification-history-card {
  max-width: 660px;
}

.notification-graph-link {
  display: block;
}

.notification-graph {
  display: block;
  width: 100%;
  max-width: 560px;
  border: 1px solid #d7dde5;
  border-radius: 4px;
  background: #fff;
}

.notification-product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.notification-product-row:has(.notification-thumb-link) {
  grid-template-columns: minmax(0, 1fr) 86px;
}

.notification-product-main {
  display: grid;
  gap: 6px;
}

.notification-thumb-link {
  display: block;
}

.notification-thumb {
  display: block;
  width: 86px;
  height: 86px;
  border: 1px solid #d7dde5;
  border-radius: 5px;
  background: #fff;
  object-fit: contain;
}

.notification-item-head,
.notification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 12px;
}

.notification-item-head {
  justify-content: space-between;
}

.notification-title {
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  text-decoration: none;
}

.notification-title:hover {
  text-decoration: underline;
}

.notification-description {
  display: grid;
  gap: 2px;
  color: #172033;
  font-size: 13px;
  line-height: 1.45;
}

.notification-actions {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.notification-actions a {
  color: #1d4ed8;
  text-decoration: none;
}

.notification-actions a:hover {
  text-decoration: underline;
}

.page-actions {
  display: flex;
  justify-content: flex-start;
  margin: -4px 0 14px;
}

.history-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.history-filter-form .compact-range {
  min-width: 0;
}

.history-filter-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

nav a {
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
}

nav a:hover {
  background: var(--soft);
}

main {
  width: min(1440px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

h1 {
  font-size: 24px;
  margin: 0 0 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric,
.panel,
.login-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 16px;
}

.metric div,
.metric span,
.hint {
  color: var(--muted);
}

.status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.token-warning {
  margin-top: 12px;
}

.token-warning ul {
  margin: 0;
  padding-left: 20px;
  color: var(--warn);
  font-weight: 600;
}

.intro-panel {
  padding: 18px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.guide-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 10px;
  min-width: 0;
  min-height: 88px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: #fff;
}

.guide-card:hover {
  background: var(--soft);
}

.guide-card span {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.guide-card strong {
  min-width: 0;
  font-size: 14px;
}

.guide-card small,
.muted-text {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.secret-form {
  margin-top: 14px;
}

.secret-change-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.field-help {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.form-advanced {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.form-advanced summary {
  cursor: pointer;
  font-weight: 700;
}

.form-advanced label {
  margin-top: 10px;
}

.compact-form {
  margin-bottom: 14px;
}

.advanced-settings {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.advanced-settings summary {
  cursor: pointer;
  font-weight: 700;
}

.advanced-settings[open] summary {
  margin-bottom: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.destination-manager {
  display: grid;
  gap: 10px;
  min-width: 260px;
  white-space: normal;
}

.destination-group {
  display: grid;
  gap: 5px;
}

.destination-list {
  display: grid;
  gap: 6px;
}

.destination-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.route-settings-panel {
  grid-column: 1 / -1;
}

.route-settings-form {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.route-settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
}

.route-settings-form .joined-input,
.route-settings-form .range-inputs {
  grid-template-columns: 1fr;
}

.route-settings-form .range-separator {
  display: none;
}

.route-settings-form button {
  width: 100%;
  white-space: normal;
}

.destination-item span,
.destination-manager code {
  overflow-wrap: anywhere;
}

.destination-add-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.secondary-button {
  background: var(--soft);
  color: var(--text);
}

.destination-only-form {
  grid-template-columns: minmax(200px, 0.8fr) minmax(260px, 1fr) 280px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.setting-row strong,
.setting-row span {
  display: block;
}

.setting-row span {
  color: var(--muted);
  font-size: 12px;
}

.user-card-list {
  display: grid;
  gap: 10px;
}

.user-card {
  display: grid;
  grid-template-columns: minmax(200px, 0.72fr) minmax(180px, 0.58fr) minmax(300px, 1fr);
  gap: 10px 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-card-header {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.user-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.user-identity strong {
  font-size: 15px;
}

.user-identity span,
.user-identity code,
.user-guide-lines code {
  overflow-wrap: anywhere;
}

.user-identity span {
  color: var(--muted);
}

.user-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}

.user-card-body {
  display: contents;
}

.user-info-block {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.mini-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-guide-lines {
  display: grid;
  gap: 3px;
}

.user-card-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.user-edit-panel {
  min-width: 0;
}

.user-edit-panel summary {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.user-edit-panel[open] summary {
  margin-bottom: 12px;
}

.user-edit-panel[open] {
  flex-basis: 100%;
  order: 2;
}

.user-edit-panel[open] ~ .inline-form {
  margin-left: auto;
  order: 3;
}

.user-billing-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.billing-memo-field {
  grid-column: 1 / -2;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin: 2px 0;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.panel-title {
  font-weight: 700;
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.destination-table {
  min-width: 1320px;
  table-layout: fixed;
}

.destination-table th,
.destination-table td {
  vertical-align: top;
}

.destination-table th:nth-child(1),
.destination-table td:nth-child(1) {
  width: 150px;
}

.destination-table th:nth-child(2),
.destination-table td:nth-child(2) {
  width: 90px;
  word-break: keep-all;
}

.destination-table th:nth-child(3),
.destination-table td:nth-child(3) {
  width: 140px;
}

.destination-table th:nth-child(4),
.destination-table td:nth-child(4) {
  width: 120px;
}

.destination-table th:nth-child(5),
.destination-table td:nth-child(5) {
  width: 330px;
}

.destination-table th:nth-child(6),
.destination-table td:nth-child(6) {
  width: 100px;
}

.destination-table th:nth-child(7),
.destination-table td:nth-child(7) {
  width: 90px;
}

.destination-table th:nth-child(8),
.destination-table td:nth-child(8) {
  width: 300px;
}

.destination-table code {
  overflow-wrap: anywhere;
}

.inline-form.destination-memo-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto;
  min-width: 0;
  align-items: center;
}

.inline-form.destination-memo-form input {
  width: 100%;
  min-width: 0;
}

.destination-table .username-edit-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
}

.destination-table .username-edit-form input {
  width: 100%;
  min-width: 0;
}

.compact-details {
  margin-top: 6px;
}

.compact-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.compact-details code {
  display: inline-block;
  max-width: 220px;
  margin-top: 4px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.destination-edit-panel {
  min-width: 0;
}

.destination-edit-panel[open] summary {
  margin-bottom: 8px;
}

.destination-webhook-form {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
}

.destination-delete-form {
  margin-top: 8px;
  flex-wrap: wrap;
}

.watcher-card-list {
  display: grid;
  gap: 10px;
}

.watcher-card {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(430px, 1.35fr) minmax(140px, auto);
  gap: 10px 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.watcher-card-header {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.watcher-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.watcher-identity strong {
  font-size: 15px;
}

.watcher-identity span {
  color: var(--muted);
}

.watcher-identity code {
  overflow-wrap: anywhere;
}

.watcher-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.watcher-condition-summary {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding-top: 6px;
}

.watcher-card-body {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 0.42fr) minmax(210px, 0.88fr);
  gap: 12px;
  min-width: 0;
}

.watcher-info-block {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  line-height: 1.55;
}

.watcher-card .destination-manager {
  min-width: 0;
}

.watcher-condition-manager {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.watcher-condition-manager-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.8fr);
  gap: 12px;
  align-items: start;
}

.watcher-condition-list {
  display: grid;
  gap: 8px;
}

.watcher-condition-item {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(300px, auto);
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.watcher-condition-main,
.watcher-condition-item > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.watcher-condition-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.condition-add-panel,
.condition-edit-panel {
  min-width: 0;
}

.condition-add-panel[open],
.condition-edit-panel[open] {
  grid-column: 1 / -1;
}

.condition-add-panel[open] summary,
.condition-edit-panel[open] summary {
  margin-bottom: 8px;
}

.condition-form {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.condition-form .condition-memo-field {
  grid-column: span 2;
}

.condition-form button {
  justify-self: end;
}

.watcher-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.watcher-card-actions .inline-form,
.watcher-card-actions .button-link {
  margin-top: 0;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

code {
  background: var(--soft);
  border-radius: 5px;
  padding: 2px 5px;
  white-space: normal;
  overflow-wrap: anywhere;
}

form {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.stack-form {
  display: grid;
  gap: 12px;
}

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

.username-edit-form {
  align-items: center;
  flex-wrap: nowrap;
}

.username-edit-form input {
  width: 160px;
  min-width: 120px;
}

td .inline-form + .inline-form,
td .inline-form + .button-link,
td .button-link + .inline-form {
  margin-top: 6px;
}

.inline-check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  white-space: nowrap;
}

.inline-check input {
  width: auto;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.plain-textarea {
  min-height: 72px;
  font-family: inherit;
  font-size: 14px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  filter: brightness(0.95);
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: none;
}

.secondary-link {
  background: var(--soft);
  color: var(--text);
}

.small-link {
  min-height: 34px;
  padding: 7px 10px;
}

.danger-button {
  background: var(--danger);
}

.plan-limit {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.plan-limit legend {
  max-width: 100%;
  padding: 0 4px;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.warn {
  background: #fef3c7;
  color: var(--warn);
}

.badge.muted {
  background: #e5e7eb;
  color: #4b5563;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 1100px) {
  .watcher-card,
  .watcher-card-body,
  .watcher-condition-manager-head,
  .watcher-condition-item {
    grid-template-columns: 1fr;
  }

  .watcher-info-block {
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .watcher-card-actions {
    justify-content: flex-start;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .watcher-condition-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    width: 100%;
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  nav {
    width: 100%;
    flex: initial;
    flex-wrap: wrap;
    gap: 6px 8px;
  }

  main {
    width: calc(100vw - 24px);
    margin-top: 18px;
  }

  .hint,
  .field-help,
  .guide-card,
  .guide-card strong,
  .guide-card small,
  .panel,
  .table-scroll,
  .watcher-info-block,
  .user-info-block,
  .destination-manager,
  .notification-description {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .metric-grid,
  .guide-grid,
  .form-grid,
  .route-settings-grid,
  .condition-form .form-grid,
  .admin-destination-form,
  .destination-only-form {
    grid-template-columns: 1fr;
  }

  .condition-form .condition-memo-field {
    grid-column: auto;
  }

  .setting-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-card-header {
    gap: 8px;
  }

  .user-badges {
    justify-content: flex-start;
  }

  .user-card {
    grid-template-columns: 1fr;
  }

  .user-card-body {
    display: grid;
    gap: 10px;
  }

  .user-info-block {
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .user-card-actions,
  .user-billing-form {
    grid-template-columns: 1fr;
  }

  .billing-memo-field {
    grid-column: auto;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .portal-body .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    min-height: 58px;
    align-items: center;
    gap: 10px 12px;
    padding: 12px;
  }

  .portal-body .brand {
    min-width: 0;
  }

  .portal-body .topbar form {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .portal-body .topbar-spacer {
    display: none;
  }

  .portal-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-wrap: wrap;
    gap: 8px;
  }

  .portal-nav a {
    padding: 7px 8px;
  }

  .portal-body main {
    width: calc(100vw - 24px);
    margin-top: 18px;
  }

  .portal-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-body .destination-only-form,
  .portal-body .name-edit-form,
  .portal-body .settings-grid,
  .portal-body .joined-input,
  .history-filter-form {
    grid-template-columns: 1fr;
  }

  .portal-body .repeat-field {
    grid-column: auto;
    max-width: none;
  }

  .portal-body .range-inputs {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .portal-body .span-2 {
    grid-column: auto;
  }

  .portal-body .stack-form > button {
    justify-self: stretch;
    min-width: 0;
  }

  .portal-destination-card {
    grid-template-columns: 1fr;
  }

  .portal-destination-actions {
    justify-content: flex-start;
  }

  .portal-destination-actions .username-edit-form {
    width: 100%;
  }

  .portal-destination-actions .username-edit-form input {
    flex: 1;
    min-width: 0;
  }

  .portal-watcher-card-header,
  .portal-watcher-card-body {
    grid-template-columns: 1fr;
  }

  .portal-watcher-badges,
  .portal-watcher-card-actions {
    justify-content: flex-start;
  }
}

/* 公開ページ(/deals) */
.deals-body {
  max-width: 100%;
  margin: 0;
}

.deals-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.deals-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.deals-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px;
}

.deals-lead {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}

.deals-empty {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
}

.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.deals-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.deals-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  background: #ffffff;
  padding: 12px;
}

.deals-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.deals-thumb-empty {
  color: var(--muted);
  font-size: 12px;
}

.deals-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  flex: 1;
}

.deals-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.deals-title:hover {
  text-decoration: underline;
}

.deals-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.deals-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
}

.deals-drop {
  background: var(--danger);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.deals-average {
  color: var(--muted);
  font-size: 12px;
}

.deals-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  padding-top: 4px;
}

.deals-meta a {
  color: var(--accent);
  font-weight: 600;
}

.deals-footer {
  max-width: 1040px;
  margin: 28px auto 0;
  padding: 16px 20px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.deals-footer p {
  margin: 4px 0;
}

.deals-policy h2 {
  font-size: 15px;
  margin: 20px 0 6px;
}

.deals-policy p {
  margin: 0 0 8px;
}

@media (max-width: 560px) {
  .deals-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .deals-thumb {
    height: 120px;
  }
}

/* 公開ページ: 商品個別ページ */
.deals-product {
  max-width: 460px;
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px 20px 28px;
  text-align: center;
}

.deals-product-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 240px;
  background: #ffffff;
}

.deals-product-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.deals-product-title {
  font-size: 16px;
  line-height: 1.4;
  margin: 0;
}

.deals-product-price-row {
  justify-content: center;
}

.deals-product .deals-price {
  font-size: 26px;
}

.deals-product-note {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.deals-product-cta {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 14px 20px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
}

.deals-product-cta:hover {
  opacity: 0.92;
}

.deals-product-back {
  color: var(--muted);
  font-size: 13px;
}
