* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f5f5; color: #1a1a1a; }
.hidden { display: none !important; }

#login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: #f5f5f5;
}
.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  width: 340px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  display: flex; flex-direction: column; gap: 12px;
}
.login-logo { font-size: 24px; font-weight: 700; color: #1D9E75; text-align: center; }
.login-sub { font-size: 13px; color: #888; text-align: center; margin-top: -6px; margin-bottom: 8px; }
.login-box input {
  padding: 12px 14px; border: 1px solid #e0e0e0;
  border-radius: 10px; font-size: 15px; outline: none;
  transition: border-color 0.2s;
}
.login-box input:focus { border-color: #1D9E75; }
#login-btn {
  padding: 13px; background: #1D9E75; color: #fff;
  border: none; border-radius: 10px; font-size: 15px;
  font-weight: 600; cursor: pointer; margin-top: 4px;
  transition: background 0.2s;
}
#login-btn:hover { background: #0F6E56; }

.navbar {
  background: #fff;
  border-bottom: 1px solid #ebebeb;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; position: sticky; top: 0; z-index: 100;
}
.nav-logo { font-size: 16px; font-weight: 700; color: #1D9E75; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-btn {
  padding: 7px 14px; border: none; background: none;
  border-radius: 8px; font-size: 14px; cursor: pointer;
  color: #555; transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: #f0f0f0; }
.nav-btn.active { background: #E1F5EE; color: #0F6E56; font-weight: 600; }
.nav-logout { color: #A32D2D !important; margin-left: 8px; }
.nav-logout:hover { background: #FCEBEB !important; }

.content { max-width: 900px; margin: 0 auto; padding: 28px 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; }

.btn-primary {
  padding: 10px 20px; background: #1D9E75; color: #fff;
  border: none; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover { background: #0F6E56; }
.btn-secondary {
  padding: 10px 20px; background: #f0f0f0; color: #333;
  border: none; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-secondary:hover { background: #e0e0e0; }

.coupon-card {
  background: #fff; border-radius: 14px;
  padding: 18px 20px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  display: flex; align-items: center; gap: 16px;
}
.coupon-card.inactive { opacity: 0.55; }
.coupon-code { font-size: 17px; font-weight: 700; font-family: monospace; color: #1D9E75; min-width: 140px; }
.coupon-label-text { font-size: 13px; color: #888; margin-top: 2px; }
.coupon-progress { flex: 1; }
.progress-bar-bg { height: 6px; background: #f0f0f0; border-radius: 3px; margin-top: 6px; }
.progress-bar-fill { height: 6px; background: #1D9E75; border-radius: 3px; transition: width 0.3s; }
.progress-bar-fill.full { background: #A32D2D; }
.coupon-meta { font-size: 12px; color: #aaa; margin-top: 4px; }
.coupon-actions { display: flex; gap: 8px; align-items: center; }
.btn-sm {
  padding: 6px 12px; border: 1px solid #e0e0e0; background: #fff;
  border-radius: 8px; font-size: 12px; cursor: pointer;
  transition: background 0.15s; white-space: nowrap;
}
.btn-sm:hover { background: #f5f5f5; }
.btn-sm.danger { border-color: #f0c0c0; color: #A32D2D; }
.btn-sm.danger:hover { background: #FCEBEB; }
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green { background: #E1F5EE; color: #085041; }
.badge-red { background: #FCEBEB; color: #A32D2D; }
.badge-gray { background: #f0f0f0; color: #888; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat-card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.07); }
.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: #1D9E75; }

.table { width: 100%; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.07); border-collapse: collapse; }
.table th { padding: 12px 16px; text-align: left; font-size: 12px; color: #888; font-weight: 600; background: #fafafa; border-bottom: 1px solid #f0f0f0; }
.table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid #f7f7f7; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafafa; }

.item-row { background: #fff; border-radius: 12px; padding: 14px 18px; margin-bottom: 8px; display: flex; align-items: center; gap: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.07); }
.item-row.inactive { opacity: 0.5; }
.item-emoji-big { font-size: 28px; }
.item-info { flex: 1; }
.item-info-name { font-size: 15px; font-weight: 600; }
.item-info-meta { font-size: 12px; color: #888; margin-top: 2px; }

.alert-error { background: #FCEBEB; color: #A32D2D; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-top: 4px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: #fff; border-radius: 16px; width: 420px; max-width: 95vw; overflow: hidden; }
.modal-header { padding: 20px 24px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #f0f0f0; }
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; padding: 4px; }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.modal-body label { font-size: 13px; color: #555; font-weight: 600; margin-bottom: -4px; }
.modal-body input { padding: 11px 14px; border: 1px solid #e0e0e0; border-radius: 10px; font-size: 14px; outline: none; }
.modal-body input:focus { border-color: #1D9E75; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f0f0f0; display: flex; gap: 10px; justify-content: flex-end; }
