:root {
  --blue: #00274c;
  --blue-deep: #001a33;
  --maize: #ffcb05;
  --ink: #18212b;
  --muted: #5b6673;
  --paper: #ffffff;
  --line: #d9e0e7;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #f4f7fa;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

header {
  background: var(--blue);
  color: white;
  border-bottom: 5px solid var(--maize);
}

.header-inner,
main,
footer {
  width: min(100% - 32px, 980px);
  margin-inline: auto;
}

.header-inner {
  padding: 20px 0 18px;
}

header h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.15;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

header p {
  margin: 5px 0 0;
  color: #e7eef5;
}

header a {
  color: #ffcb05;
}

main {
  margin-top: 26px;
  margin-bottom: 32px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(22px, 4vw, 38px);
  box-shadow: 0 12px 30px rgba(0, 39, 76, 0.08);
}

h2 {
  margin-top: 0;
  color: var(--blue);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

main h2:not(:first-of-type) {
  margin-top: 2rem;
}

.hero-image {
  float: right;
  display: block;
  width: 128px;
  height: 128px;
  margin: 0 0 18px 28px;
  border-radius: 50%;
  border: 1px solid #bcc8d4;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  text-decoration: none;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-image:hover,
.hero-image:focus-visible {
  outline: 3px solid rgba(255, 203, 5, 0.85);
  outline-offset: 2px;
}

p { margin: 0 0 1rem; }

.actions {
  margin: 1.25rem 0 1.3rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.actions a {
  display: block;
  padding: 12px 15px;
  border: 1px solid #b7c4d0;
  border-left: 5px solid var(--maize);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.actions a:hover,
.actions a:focus-visible {
  background: #eef4f8;
  outline: 3px solid rgba(255, 203, 5, 0.55);
  outline-offset: 2px;
}

.coupons {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.coupons > li {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.coupon-art {
  flex: 0 0 auto;
  display: inline-block;
  line-height: 0;
  vertical-align: middle;
}

.coupon-art img {
  width: 36px;
  height: auto;
  display: block;
}

.coupon-body {
  min-width: 0;
  flex: 1;
}

.coupons .course {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
}

.coupons a.course:hover,
.coupons a.course:focus-visible {
  text-decoration: underline;
}

.coupons .desc {
  margin: 0.35rem 0 0.45rem;
}

.coupons .meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.coupon-offers {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.coupon-offers li {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.coupon-offer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}

.coupon-offer-line {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.coupon-offer .meta {
  white-space: nowrap;
}

.coupon-offer .desc {
  margin: 0;
  width: 100%;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: normal;
}

.coupon-offer:hover,
.coupon-offer:focus-visible {
  outline: 3px solid rgba(255, 203, 5, 0.85);
  outline-offset: 2px;
}

.coupons code,
.admin-table code {
  font-size: 0.95rem;
  background: #eef4f8;
  padding: 2px 6px;
  border-radius: 4px;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

footer {
  padding: 0 0 28px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

footer a { color: var(--blue); }

.flash {
  padding: 10px 12px;
  border-radius: 7px;
  background: #eef8ee;
  border: 1px solid #b7d7b7;
}

.flash.error {
  background: #fdeeee;
  border-color: #e3b6b6;
}

.coupon-form,
.login-form {
  display: grid;
  gap: 12px;
  margin-bottom: 2rem;
  max-width: 640px;
}

.coupon-form label,
.login-form label {
  display: grid;
  gap: 4px;
  font-weight: 600;
}

.coupon-form input,
.coupon-form select,
.coupon-form textarea,
.login-form input {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #b7c4d0;
  border-radius: 6px;
}

.coupon-form textarea {
  width: 100%;
  resize: vertical;
}

.coupon-form .check-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 600;
}

.coupon-form .check-label input {
  width: auto;
  margin-top: 3px;
  padding: 0;
}

.form-actions {
  margin: 0;
  display: flex;
  gap: 14px;
  align-items: center;
}

button {
  font: inherit;
  font-weight: 700;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: white;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: var(--blue-deep);
}

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

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

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

.admin-table th {
  color: var(--blue);
  font-size: 0.9rem;
}

.admin-table .expired {
  color: var(--muted);
  background: #f7f7f7;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.row-actions {
  white-space: nowrap;
}

.row-actions form,
.inline-form {
  display: inline;
  margin-left: 8px;
}

button.secondary {
  background: #f8fafc;
  color: var(--blue);
  border: 1px solid #b7c4d0;
}

button.secondary:hover,
button.secondary:focus-visible {
  background: #eef4f8;
}

button.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}

button.linkish:hover,
button.linkish:focus-visible {
  background: none;
  text-decoration: underline;
}

.note .linkish {
  margin-left: 0.75rem;
}

.reorder-toggle-wrap {
  margin: 1rem 0 0;
}

.reorder-list {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-width: 720px;
}

.reorder-list li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  cursor: grab;
}

.reorder-list li.dragging {
  opacity: 0.45;
}

.reorder-grip {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: -2px;
  user-select: none;
}

.reorder-title {
  font-weight: 700;
  color: var(--blue);
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3vh 3vw;
  background: rgba(0, 0, 0, 0.55);
}

.confirm-modal.open {
  display: flex;
}

.confirm-box {
  width: min(100%, 520px);
  background: var(--paper);
  border-radius: 12px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--maize);
  padding: 22px 24px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.confirm-box h2 {
  margin: 0 0 0.75rem;
}

.confirm-box p:last-of-type {
  margin-bottom: 0;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 1.1rem;
}

@media (max-width: 720px) {
  .hero-image {
    float: none;
    display: block;
    width: 128px;
    height: 128px;
    margin: 0 0 20px;
  }

  .coupon-art img {
    width: 36px;
  }

  main { margin-top: 16px; }
}
