body{font-family:-apple-system,BlinkMacSystemFont,'Hiragino Sans','Yu Gothic UI',sans-serif;margin:0;background:#f6f7fb;color:#222}
a{color:#1f4ea8;text-decoration:none}a:hover{text-decoration:underline}

/* 管理画面は横幅を広く使う */
.wrapper{max-width:none;margin:0;padding:20px 24px}
.topbar{background:#fff;border-bottom:1px solid #ddd}
.topbar .inner{max-width:none;margin:0;padding:16px 24px;display:flex;justify-content:space-between;align-items:center}

.topnav{display:flex;gap:12px;flex-wrap:wrap;margin-top:12px}
.topnav a,.topnav span{padding:10px 14px;border-radius:10px;background:#eef2ff;color:#1a2859}
.topnav .active{background:#1f4ea8;color:#fff}
.topnav .disabled{opacity:.45;pointer-events:none}
.card{background:#fff;border:1px solid #ddd;border-radius:14px;padding:20px;margin-bottom:20px}
h1,h2,h3{margin-top:0}
label{display:block;font-weight:700;margin-bottom:6px}
input[type=text],input[type=email],input[type=password],input[type=datetime-local],select,textarea{width:100%;padding:12px;border:1px solid #bbb;border-radius:10px;box-sizing:border-box}
textarea{min-height:160px}
button,.btn{display:inline-block;padding:12px 18px;border:0;border-radius:10px;background:#1f4ea8;color:#fff;cursor:pointer}
.btn.secondary{background:#5b6477}.btn.danger{background:#b42318}.btn.light{background:#e8eefc;color:#1a2859}
.grid{display:grid;gap:16px}.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;background:#fff}
th,td{padding:10px;border-bottom:1px solid #e5e7eb;text-align:left;vertical-align:top}
.flash{padding:12px 14px;border-radius:10px;margin-bottom:14px}.flash.success{background:#e8f7ed;color:#106b34}.flash.error{background:#ffe9e7;color:#9f1c12}
.form-row{margin-bottom:16px}
.small{font-size:12px;color:#666}.muted{color:#666}
.filter-row{display:grid;grid-template-columns:1.2fr 1.5fr 1fr auto;gap:10px;margin-bottom:10px}

/* ===== 公開フォーム専用（subscribe / unsubscribe） ===== */
/* 管理画面に影響しないよう、inline style の max-width:640px を持つ wrapper 配下だけに適用 */
body:has(.wrapper[style*="max-width:640px"]){
  background:#fbf8f2;
}

.wrapper[style*="max-width:640px"]{
  max-width:640px !important;
  margin:0 auto !important;
  padding:24px 16px 40px !important;
}

.wrapper[style*="max-width:640px"] .card{
  background:#fffdf9;
  border:1px solid #ece3d6;
  border-radius:16px;
  box-shadow:0 8px 24px rgba(86, 72, 40, .08);
  padding:24px 20px;
}

.wrapper[style*="max-width:640px"] h1{
  font-size:1.35rem;
  line-height:1.4;
  font-weight:700;
  color:#5c4b34;
  margin:0 0 12px;
}

.wrapper[style*="max-width:640px"] p{
  color:#5e564b;
  line-height:1.8;
}

.wrapper[style*="max-width:640px"] .form-row{
  margin-bottom:18px;
}

.wrapper[style*="max-width:640px"] label{
  font-size:.95rem;
  color:#5c4b34;
  margin-bottom:8px;
}

.wrapper[style*="max-width:640px"] input[type=text],
.wrapper[style*="max-width:640px"] input[type=email],
.wrapper[style*="max-width:640px"] select,
.wrapper[style*="max-width:640px"] textarea{
  border:1px solid #d9cfbf;
  border-radius:12px;
  background:#fff;
  padding:13px 14px;
  font-size:16px;
}

.wrapper[style*="max-width:640px"] input[type=text]:focus,
.wrapper[style*="max-width:640px"] input[type=email]:focus,
.wrapper[style*="max-width:640px"] select:focus,
.wrapper[style*="max-width:640px"] textarea:focus{
  outline:none;
  border-color:#89a85a;
  box-shadow:0 0 0 3px rgba(137,168,90,.14);
}

.wrapper[style*="max-width:640px"] button,
.wrapper[style*="max-width:640px"] .btn{
  border-radius:12px;
  padding:14px 22px;
  font-size:1rem;
  font-weight:700;
  background:#89a85a;
  color:#fff;
}

.wrapper[style*="max-width:640px"] .btn.secondary,
.wrapper[style*="max-width:640px"] button.secondary{
  background:#efe6d8;
  color:#5c4b34;
  border:1px solid #ddcfba;
}

.wrapper[style*="max-width:640px"] .flash{
  border-radius:12px;
}

.wrapper[style*="max-width:640px"] .card .card{
  background:#f8f4ec;
  border:1px solid #ece3d6;
  box-shadow:none;
}

@media (max-width: 768px){
  .grid-2,.grid-3,.filter-row{grid-template-columns:1fr}
  .topbar .inner{display:block}
  .wrapper{padding:16px}
}

@media (max-width: 640px){
  .wrapper[style*="max-width:640px"]{
    padding:16px 12px 28px !important;
  }

  .wrapper[style*="max-width:640px"] .card{
    padding:20px 16px;
    border-radius:14px;
  }

  .wrapper[style*="max-width:640px"] h1{
    font-size:1.2rem;
  }

  .wrapper[style*="max-width:640px"] button,
  .wrapper[style*="max-width:640px"] .btn{
    width:100%;
    margin-top:10px;
  }

  .wrapper[style*="max-width:640px"] form[style*="inline-block"]{
    display:block !important;
    margin-right:0 !important;
  }
}
