:root {
  --bg: #f7f5fc;
  --bg-accent: #f0e9fb;
  --panel: #ffffff;
  --ink: #241c3d;
  --muted: #766f92;
  --line: #e8e1f5;
  --brand: #7c3aed;
  --brand2: #ec4899;
  --brand-dark: #5b21b6;
  --brand-soft: #f3e8ff;
  --gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 45%, #ec4899 100%);
  --warn: #b45309;
  --warn-bg: #fff4e0;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --success: #059669;
  --success-bg: #e6f7f0;
  --shadow-sm: 0 1px 2px rgba(84, 33, 150, 0.06), 0 1px 1px rgba(84, 33, 150, 0.04);
  --shadow-md: 0 8px 24px -8px rgba(89, 34, 150, 0.22);
  --shadow-lift: 0 14px 32px -12px rgba(89, 34, 150, 0.3);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14101f;
    --bg-accent: #1b1530;
    --panel: #1e1832;
    --ink: #f1ecfb;
    --muted: #a79cc4;
    --line: #322a4d;
    --brand: #a855f7;
    --brand2: #f472b6;
    --brand-dark: #c084fc;
    --brand-soft: #2c2148;
    --warn-bg: #3a2a12;
    --danger-bg: #3a1a1a;
    --success-bg: #123529;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
    --shadow-lift: 0 14px 32px -12px rgba(0, 0, 0, 0.6);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 480px at 12% -10%, var(--bg-accent), transparent),
    radial-gradient(900px 420px at 100% 0%, rgba(236, 73, 153, 0.12), transparent),
    var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic Medium", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  background: var(--gradient);
  box-shadow: 0 4px 20px -6px rgba(89, 34, 150, 0.45);
  position: sticky;
  top: 0;
  z-index: 10;
}

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #ffffff;
}

.brand strong {
  font-size: 21px;
  letter-spacing: 0.01em;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.brand span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

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

.nav a {
  color: rgba(255, 255, 255, 0.92);
}

.nav a,
.button,
button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.24);
  text-decoration: none;
  transform: translateY(-1px);
}

/* Buttons inside panels/forms (not in the gradient topbar) sit on light backgrounds */
.panel .button,
.panel button,
form button,
.actions .button,
.inline-form button {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.panel .button:hover,
.panel button:hover,
form button:hover,
.actions .button:hover,
.inline-form button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button.primary,
button.primary {
  background: var(--gradient);
  border-color: transparent;
  color: #ffffff !important;
  box-shadow: 0 6px 16px -6px rgba(124, 58, 237, 0.55);
}

.button.primary:hover,
button.primary:hover {
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -6px rgba(124, 58, 237, 0.65);
}

main.wrap {
  padding: 32px 0 56px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 18px;
}

h1,
h2,
h3 {
  margin: 0 0 14px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

h2::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gradient);
  vertical-align: middle;
}

h3 {
  font-size: 17px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.notice {
  border: 1px solid #bcd8ff;
  border-radius: 12px;
  background: #eef4ff;
  color: #1e3a8a;
  padding: 13px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.error {
  border-color: #f5c2c2;
  background: var(--danger-bg);
  color: var(--danger);
}

.list {
  display: grid;
  gap: 12px;
}

.row {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: #d9c8fb;
}

.row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row-title a {
  font-weight: 700;
  color: var(--ink);
  font-size: 15.5px;
}

.row-title a:hover {
  color: var(--brand-dark);
}

.meta {
  color: var(--muted);
  font-size: 13.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

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

.badge.gray {
  background: var(--bg-accent);
  color: var(--muted);
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 11px 13px;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.reply {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.reply:first-child {
  border-top: 0;
  padding-top: 0;
}

.reply-body {
  white-space: pre-wrap;
}

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

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

.table th {
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.table tbody tr:hover {
  background: var(--bg-accent);
}

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

.inline-form select {
  width: auto;
  min-width: 130px;
}

.search {
  display: flex;
  gap: 8px;
}

.search input {
  min-width: 0;
}

@media (max-width: 840px) {
  .topbar .wrap,
  .grid {
    grid-template-columns: 1fr;
  }

  .topbar .wrap {
    align-items: flex-start;
    padding: 14px 0;
  }

  .nav {
    justify-content: flex-start;
  }

  .table,
  .table tbody,
  .table tr,
  .table td,
  .table th {
    display: block;
    width: 100%;
  }

  .table tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }
}
