:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --text: #18231f;
  --muted: #68736d;
  --green: #0f5a43;
  --green-dark: #0b4534;
  --green-soft: #e2eee8;
  --border: #d9d5ca;
  --danger: #a92a20;
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0, rgba(236, 183, 77, .14), transparent 30rem),
    linear-gradient(#faf8f3, var(--bg) 34rem);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
[hidden], .is-hidden { display: none !important; }
.wrap { width: min(100% - 32px, 980px); margin-inline: auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-block: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px;
  background: var(--green);
  color: white;
  font-size: 21px;
  font-weight: 900;
  box-shadow: 0 9px 22px rgba(15, 90, 67, .2);
}
.brand small {
  display: block;
  color: rgba(15, 90, 67, .72);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.brand strong { display: block; font-size: 19px; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 17px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: white; }
.button-primary:hover { background: var(--green-dark); }
.button-outline { border-color: var(--border); background: white; }
.button-large { width: 100%; min-height: 49px; border-radius: 12px; font-size: 15px; }
.button:disabled { opacity: .6; cursor: wait; }

.page-main { min-height: calc(100vh - 180px); padding-block: 40px 70px; }
.intro { margin-bottom: 23px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 14px; font-weight: 800; }
.intro h1 { margin: 0; font-size: clamp(32px, 5vw, 47px); line-height: 1.08; letter-spacing: -.045em; }
.intro p:not(.eyebrow) { margin: 9px 0 0; color: var(--muted); }
.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.counter { flex: none; color: var(--muted); font-size: 14px; }
.counter strong { color: var(--text); }

.alert {
  margin-bottom: 18px;
  border: 1px solid #efc6c2;
  border-radius: 13px;
  padding: 13px 15px;
  background: #fff0ee;
  color: var(--danger);
  font-size: 14px;
}
.alert-success { border-color: #c6dfcf; background: #eff9f2; color: var(--green-dark); }

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  gap: 10px;
  margin-bottom: 19px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 21px;
  padding: 13px;
  background: rgba(255, 253, 248, .92);
  box-shadow: 0 20px 60px rgba(35, 43, 38, .07);
}
.search-field { position: relative; display: flex; align-items: center; }
.search-field > span { position: absolute; left: 14px; color: var(--muted); font-size: 21px; }
.search-field input { padding-left: 42px; }

input, select, textarea {
  width: 100%;
  min-height: 45px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
}
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(42, 118, 93, .24);
  outline-offset: 2px;
}
.search-panel input, .search-panel select { min-height: 46px; border-color: transparent; background: #eeeae1; }

.coupon-list { display: grid; gap: 11px; }
.coupon-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  min-height: 92px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 19px;
  padding: 15px 16px 15px 21px;
  background: var(--card);
  box-shadow: 0 12px 38px rgba(35, 43, 38, .055);
}
.coupon-media {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}
.coupon-media span { font-size: 18px; }
.coupon-media img { width: 100%; height: 100%; object-fit: cover; }
.coupon-copy { min-width: 0; }
.coupon-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.coupon-copy h2 { margin: 0; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.coupon-copy p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.coupon-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.tag { border-radius: 999px; padding: 3px 8px; background: var(--green-soft); color: var(--green-dark); font-size: 10px; font-weight: 800; }
.tag-danger { background: #ffe7e4; color: var(--danger); }
.code-button {
  display: flex;
  max-width: 245px;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px 7px 14px;
  background: white;
  cursor: pointer;
}
.code-button > span { overflow: hidden; font-family: Consolas, monospace; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.code-button small { color: var(--green); font-weight: 800; }

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--border);
  border-radius: 20px;
  background: rgba(255, 253, 248, .7);
  padding: 30px;
  text-align: center;
}
.empty-state > span { display: grid; width: 47px; height: 47px; place-items: center; border-radius: 14px; background: var(--green-soft); color: var(--green); font-size: 21px; font-weight: 900; }
.empty-state h2, .empty-state p { margin: 0; }
.empty-state p { margin-bottom: 9px; color: var(--muted); }

.form-page { max-width: 720px; }
.coupon-form {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 23px;
  padding: 24px;
  background: rgba(255, 253, 248, .95);
  box-shadow: 0 20px 60px rgba(35, 43, 38, .07);
}
.coupon-form label { display: grid; gap: 7px; }
.coupon-form label > span { font-size: 13px; font-weight: 750; }
.coupon-form label > small { color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mono-input { font-family: Consolas, monospace; letter-spacing: .04em; }
.upload-status { min-height: 0; margin: -4px 0 -6px; color: var(--green); font-size: 13px; }
.upload-status:empty { display: none; }
.site-footer { border-top: 1px solid rgba(217, 213, 202, .8); padding-block: 22px 32px; color: var(--muted); font-size: 12px; }

@media (max-width: 700px) {
  .search-panel { grid-template-columns: 1fr 130px; }
  .search-panel .button { grid-column: 1 / -1; }
}

@media (max-width: 580px) {
  .wrap { width: min(100% - 24px, 980px); }
  .site-header { padding-block: 16px; }
  .brand small { display: none; }
  .brand strong { font-size: 17px; }
  .brand-mark { width: 40px; height: 40px; }
  .page-main { padding-block: 28px 52px; }
  .intro-row { display: block; }
  .counter { display: block; margin-top: 12px; }
  .search-panel { grid-template-columns: 1fr; padding: 10px; border-radius: 16px; }
  .search-panel .button { grid-column: auto; }
  .coupon-row { grid-template-columns: 46px minmax(0, 1fr); gap: 12px; }
  .coupon-media { width: 46px; height: 46px; }
  .coupon-action { grid-column: 1 / -1; padding-left: 58px; }
  .coupon-action .button, .code-button { width: 100%; max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .coupon-form { padding: 18px; }
}
