:root {
  --ink: #192023;
  --base: #f6f4ef;
  --surface: rgba(255, 255, 255, 0.72);
  --line: rgba(25, 32, 35, 0.15);
  --accent: #e35b2d;
  --accent-2: #008f86;
  --shadow: 0 18px 38px rgba(25, 32, 35, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans JP", sans-serif;
  background:
    radial-gradient(circle at 10% -10%, rgba(227, 91, 45, 0.24), transparent 48%),
    radial-gradient(circle at 90% 0%, rgba(0, 143, 134, 0.2), transparent 44%),
    linear-gradient(145deg, #faf8f5 0%, var(--base) 100%);
  min-height: 100vh;
}

.mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
      rgba(25, 32, 35, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(25, 32, 35, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  position: relative;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 40px;
  text-align: center;
  width: 320px;
  animation: rise 700ms ease both;
}

.login-card h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 22px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.login-card p {
  font-size: 14px;
  color: rgba(25, 32, 35, 0.7);
  margin-bottom: 24px;
}

#google-signin-button {
  display: flex;
  justify-content: center;
}

.error-message {
  color: #b43c24;
  font-size: 13px;
  margin-top: 16px;
}

.admin-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.admin-header h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.01em;
}

.admin-nav {
  flex: 1;
  margin-left: 24px;
  display: flex;
  gap: 18px;
}

.admin-nav a {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.admin-nav a:hover {
  text-decoration: underline;
}

.admin-header button {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(98deg, var(--accent), #f29532);
  cursor: pointer;
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.admin-header button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(227, 91, 45, 0.25);
}

.target-filter-input {
  width: 100%;
  max-width: 320px;
  padding: 8px 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  color: var(--ink);
}

.display-name-form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.display-name-form input {
  min-width: 0;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  font: inherit;
}

.admin-main {
  position: relative;
  padding: 32px 24px;
}

.dashboard-section {
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  animation: rise 700ms ease both;
}

.dashboard-section h2 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 18px;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.dashboard-section h3 {
  font-size: 12px;
  color: rgba(25, 32, 35, 0.65);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.daily-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.daily-summary-header h2 {
  margin: 0;
}

.daily-summary-date-label {
  font-size: 13px;
  color: rgba(25, 32, 35, 0.7);
}

.daily-summary-date-label input[type="date"] {
  margin-left: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
}

.daily-summary-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.daily-hourly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

.daily-hourly-header h3 {
  margin: 0;
}

.daily-hourly-category-label {
  font-size: 13px;
  color: rgba(25, 32, 35, 0.7);
}

.daily-hourly-category-label select {
  margin-left: 6px;
  padding: 5px 8px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
}

#daily-hourly-chart {
  width: 100%;
  max-width: 760px;
  height: auto;
}

.dashboard-summary-line {
  font-size: 13px;
  color: rgba(25, 32, 35, 0.7);
  margin: 0 0 16px;
}

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

.dashboard-table th,
.dashboard-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.dashboard-table th {
  color: rgba(25, 32, 35, 0.6);
  font-weight: 600;
}

.category-detail-button {
  padding: 0;
  border: 0;
  color: var(--accent-2);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.category-detail-button:hover {
  text-decoration: underline;
}

.product-notifications-dialog {
  height: min(760px, calc(100vh - 48px));
  width: min(720px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(25, 32, 35, 0.28);
}

.product-notifications-dialog[open] {
  display: flex;
  flex-direction: column;
}

.product-notifications-dialog::backdrop {
  background: rgba(25, 32, 35, 0.52);
}

.dialog-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 0;
  font-size: 18px;
}

.dialog-header p {
  margin: 4px 0 0;
  color: rgba(25, 32, 35, 0.65);
  font-size: 13px;
}

.dialog-close-button {
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.product-notifications-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px 6px;
}

.product-notifications-toolbar input {
  width: min(360px, 100%);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 13px;
}

.product-notifications-toolbar span {
  flex: 0 0 auto;
  color: rgba(25, 32, 35, 0.65);
  font-size: 12px;
}

.product-notifications-content {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 24px 20px;
}

.product-notification-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.product-notification-copy {
  min-width: 0;
}

.product-notification-copy h3 {
  margin: 0 0 5px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.product-notification-copy time {
  color: rgba(25, 32, 35, 0.65);
  font-size: 12px;
}

.product-page-link {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: #fff;
  background: var(--accent-2);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.dialog-state {
  padding: 24px 0;
  text-align: center;
}

.table-action-button,
.primary-button,
.secondary-button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.table-action-button,
.primary-button {
  color: #fff;
  background: var(--accent-2);
}

.secondary-button {
  color: var(--ink);
  background: #fff;
}

.table-action-button:disabled,
.primary-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.stripe-product-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(25, 32, 35, 0.28);
}

.stripe-product-dialog::backdrop {
  background: rgba(25, 32, 35, 0.52);
}

.stripe-product-form-fields {
  display: grid;
  gap: 14px;
  padding: 20px 24px;
}

.stripe-product-form-fields label {
  display: grid;
  gap: 6px;
  color: rgba(25, 32, 35, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.stripe-product-form-fields input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.stripe-product-form-fields input[readonly] {
  background: var(--base);
}

.stripe-product-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
}

.direct-link-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.direct-link-toolbar .dashboard-summary-line {
  margin-bottom: 0;
}

.operation-message {
  margin: 0 0 16px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.direct-link-categories-table {
  min-width: 720px;
}

.direct-link-categories-table td:nth-child(2) strong,
.direct-link-categories-table td:nth-child(2) code {
  display: block;
}

.direct-link-categories-table td:nth-child(2) code {
  margin-top: 4px;
  color: rgba(25, 32, 35, 0.58);
  font-size: 11px;
}

.direct-link-detail-row td {
  padding: 0 10px 18px;
  background: rgba(255, 255, 255, 0.38);
}

.direct-link-panel {
  padding: 16px;
  border-left: 3px solid var(--accent-2);
}

.direct-link-add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.direct-link-add-form input {
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.direct-link-bulk-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.direct-link-bulk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.direct-link-bulk-header label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.direct-link-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
}

.direct-link-bulk-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.direct-link-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.direct-link-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.direct-link-list a {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--accent-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.direct-link-remove-button {
  flex: 0 0 auto;
  color: #b43c24;
}

@media (max-width: 680px) {
  .admin-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .admin-header h1 {
    flex: 1 1 auto;
  }

  .admin-nav {
    order: 3;
    flex: 1 0 100%;
    margin-left: 0;
    overflow-x: auto;
    white-space: nowrap;
  }

  .direct-link-toolbar,
  .direct-link-add-form {
    align-items: stretch;
    flex-direction: column;
  }

  .direct-link-categories-table {
    min-width: 0;
  }

  .direct-link-categories-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .direct-link-categories-table,
  .direct-link-categories-table tbody,
  .direct-link-category-row,
  .direct-link-detail-row {
    display: block;
    width: 100%;
  }

  .direct-link-category-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }

  .direct-link-category-row td {
    padding: 0;
    border: 0;
  }

  .direct-link-category-row td:first-child {
    grid-row: 1 / span 3;
  }

  .direct-link-category-row td:not(:first-child) {
    grid-column: 2;
  }

  .direct-link-category-row .table-action-button {
    width: 100%;
  }

  .direct-link-detail-row td {
    display: block;
    padding: 0 0 18px;
  }

  .direct-link-panel {
    padding: 14px 0 14px 12px;
  }

  .direct-link-list li {
    align-items: stretch;
    flex-direction: column;
  }

  .direct-link-list a {
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .product-notification-row {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .product-page-link {
    align-self: flex-start;
  }
}

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

.anomaly-table {
  min-width: 980px;
}

.anomaly-table code {
  font-size: 12px;
  white-space: nowrap;
}

.anomaly-status {
  font-size: 12px;
  font-weight: 700;
}

.anomaly-status-sent {
  color: var(--accent-2);
}

.anomaly-status-failed {
  color: #b43c24;
}

.anomaly-status-pending {
  color: #8a6415;
}

.errors-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.errors-toolbar .target-filter-input {
  margin-bottom: 0;
}

.errors-page-size-label {
  font-size: 13px;
  color: rgba(25, 32, 35, 0.7);
}

.errors-page-size-label select {
  margin-left: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
}

.errors-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}

.errors-pager button {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  cursor: pointer;
  transition: transform 170ms ease;
}

.errors-pager button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.errors-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

